src/ORM/RelationList.php
public function forForeignID($id)
    {
        // Turn a 1-element array into a simple value
        if (is_array($id) && sizeof($id) == 1) {
            $id = reset($id);
        }

        // Calculate the new filter
        $filter = $this->foreignIDFilter($id);

        $list = $this->alterDataQuery(function (DataQuery $query) use ($id, $filter) {
            // Check if there is an existing filter, remove if there is
            $currentFilter = $query->getQueryParam('Foreign.Filter');
            if ($currentFilter) {
                try {
                    $query->removeFilterOn($currentFilter);
                } catch (Exception $e) {
                    /* NOP */
                }
            }

            // Add the new filter
            $query->setQueryParam('Foreign.ID', $id);
            $query->setQueryParam('Foreign.Filter', $filter);
            $query->where($filter);
        });

        return $list;
    }
public function forForeignID($id)
    {
        // Turn a 1-element array into a simple value
        if (is_array($id) && sizeof($id) == 1) {
            $id = reset($id);
        }

        // Calculate the new filter
        $filter = $this->foreignIDFilter($id);

        $list = $this->alterDataQuery(function (DataQuery $query) use ($id, $filter) {
            // Check if there is an existing filter, remove if there is
            $currentFilter = $query->getQueryParam('Foreign.Filter');
            if ($currentFilter) {
                try {
                    $query->removeFilterOn($currentFilter);
                } catch (Exception $e) {
                    /* NOP */
                }
            }

            // Add the new filter
            $query->setQueryParam('Foreign.ID', $id);
            $query->setQueryParam('Foreign.Filter', $filter);
            $query->where($filter);
        });

        return $list;
    }
public function forForeignID ( $ id ) { // Turn a 1-element array into a simple value if ( is_array ( $ id ) && sizeof ( $ id ) == 1 ) { $ id = reset ( $ id ) ; } // Calculate the new filter $ filter = $ this -> foreignIDFilter ( $ id ) ; $ list = $ this -> alterDataQuery ( function ( DataQuery $ query ) use ( $ id , $ filter ) { // Check if there is an existing filter, remove if there is $ currentFilter = $ query -> getQueryParam ( 'Foreign.Filter' ) ; if ( $ currentFilter ) { try { $ query -> removeFilterOn ( $ currentFilter ) ; } catch ( Exception $ e ) { /* NOP */ } } // Add the new filter $ query -> setQueryParam ( 'Foreign.ID' , $ id ) ; $ query -> setQueryParam ( 'Foreign.Filter' , $ filter ) ; $ query -> where ( $ filter ) ; } ) ; return $ list ; }
Returns a copy of this list with the ManyMany relationship linked to
the given foreign ID.

@param int|array $id An ID or an array of IDs.

@return static
Returns a copy of this list with the ManyMany relationship linked to the given foreign ID .