src/ORM/ManyManyList.php
public function getExtraData($componentName, $itemID)
    {
        $result = [];

        // Skip if no extrafields or unsaved record
        if (empty($this->extraFields) || empty($itemID)) {
            return $result;
        }

        if (!is_numeric($itemID)) {
            throw new InvalidArgumentException('ManyManyList::getExtraData() passed a non-numeric child ID');
        }

        $cleanExtraFields = [];
        foreach ($this->extraFields as $fieldName => $dbFieldSpec) {
            $cleanExtraFields[] = "\"{$fieldName}\"";
        }
        $query = SQLSelect::create($cleanExtraFields, "\"{$this->joinTable}\"");
        $filter = $this->foreignIDWriteFilter($this->getForeignID());
        if ($filter) {
            $query->setWhere($filter);
        } else {
            throw new BadMethodCallException("Can't call ManyManyList::getExtraData() until a foreign ID is set");
        }
        $query->addWhere([
            "\"{$this->joinTable}\".\"{$this->localKey}\"" => $itemID
        ]);
        $queryResult = $query->execute()->current();
        if ($queryResult) {
            foreach ($queryResult as $fieldName => $value) {
                $result[$fieldName] = $value;
            }
        }

        return $result;
    }
public function getExtraData($componentName, $itemID)
    {
        $result = [];

        // Skip if no extrafields or unsaved record
        if (empty($this->extraFields) || empty($itemID)) {
            return $result;
        }

        if (!is_numeric($itemID)) {
            throw new InvalidArgumentException('ManyManyList::getExtraData() passed a non-numeric child ID');
        }

        $cleanExtraFields = [];
        foreach ($this->extraFields as $fieldName => $dbFieldSpec) {
            $cleanExtraFields[] = "\"{$fieldName}\"";
        }
        $query = SQLSelect::create($cleanExtraFields, "\"{$this->joinTable}\"");
        $filter = $this->foreignIDWriteFilter($this->getForeignID());
        if ($filter) {
            $query->setWhere($filter);
        } else {
            throw new BadMethodCallException("Can't call ManyManyList::getExtraData() until a foreign ID is set");
        }
        $query->addWhere([
            "\"{$this->joinTable}\".\"{$this->localKey}\"" => $itemID
        ]);
        $queryResult = $query->execute()->current();
        if ($queryResult) {
            foreach ($queryResult as $fieldName => $value) {
                $result[$fieldName] = $value;
            }
        }

        return $result;
    }
public function getExtraData ( $ componentName , $ itemID ) { $ result = [ ] ; // Skip if no extrafields or unsaved record if ( empty ( $ this -> extraFields ) || empty ( $ itemID ) ) { return $ result ; } if ( ! is_numeric ( $ itemID ) ) { throw new InvalidArgumentException ( 'ManyManyList::getExtraData() passed a non-numeric child ID' ) ; } $ cleanExtraFields = [ ] ; foreach ( $ this -> extraFields as $ fieldName => $ dbFieldSpec ) { $ cleanExtraFields [ ] = "\"{$fieldName}\"" ; } $ query = SQLSelect :: create ( $ cleanExtraFields , "\"{$this->joinTable}\"" ) ; $ filter = $ this -> foreignIDWriteFilter ( $ this -> getForeignID ( ) ) ; if ( $ filter ) { $ query -> setWhere ( $ filter ) ; } else { throw new BadMethodCallException ( "Can't call ManyManyList::getExtraData() until a foreign ID is set" ) ; } $ query -> addWhere ( [ "\"{$this->joinTable}\".\"{$this->localKey}\"" => $ itemID ] ) ; $ queryResult = $ query -> execute ( ) -> current ( ) ; if ( $ queryResult ) { foreach ( $ queryResult as $ fieldName => $ value ) { $ result [ $ fieldName ] = $ value ; } } return $ result ; }
Find the extra field data for a single row of the relationship join
table, given the known child ID.

@param string $componentName The name of the component
@param int $itemID The ID of the child for the relationship

@return array Map of fieldName => fieldValue
Find the extra field data for a single row of the relationship join table given the known child ID .