JoinProcessorInterface.php 1.19 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Framework\Api\ExtensionAttribute;

use Magento\Framework\Data\Collection\AbstractDb as DbCollection;

/**
 * Join processor allows to join extension attributes during collections loading.
 *
 * @api
 * @since 100.0.2
 */
interface JoinProcessorInterface
{
    /**
     * Processes extension attributes join instructions to add necessary joins to the collection of extensible entities.
     *
     * @param DbCollection $collection
     * @param string|null $extensibleEntityClass
     * @return void
     * @throws \LogicException
     */
    public function process(DbCollection $collection, $extensibleEntityClass = null);

    /**
     * Extract extension attributes into separate extension object.
     *
     * Complex extension attributes will be populated using flat data loaded.
     * Data items used for extension object population are unset from the $data.
     *
     * @param string $extensibleEntityClass
     * @param array $data
     * @return array
     * @throws \LogicException
     */
    public function extractExtensionAttributes($extensibleEntityClass, array $data);
}