src/CRUDlex/MySQLData.php
protected function getManyIds(array $fields, array $params)
    {
        $manyIds = [];
        foreach ($fields as $field) {
            $thisField    = $this->definition->getSubTypeField($field, 'many', 'thisField');
            $thatField    = $this->definition->getSubTypeField($field, 'many', 'thatField');
            $queryBuilder = $this->database->createQueryBuilder();
            $queryBuilder
                ->select('`'.$thisField.'`')
                ->from($field)
                ->where('`'.$thatField.'` IN (?)')
                ->setParameter(0, array_column($params[$field], 'id'), Connection::PARAM_STR_ARRAY)
                ->groupBy('`'.$thisField.'`')
            ;
            $queryResult = $queryBuilder->execute();
            $manyResults = $queryResult->fetchAll(\PDO::FETCH_ASSOC);
            $manyIds     = array_merge($manyIds, array_column($manyResults, $thisField));

        }
        return $manyIds;
    }
protected function getManyIds(array $fields, array $params)
    {
        $manyIds = [];
        foreach ($fields as $field) {
            $thisField    = $this->definition->getSubTypeField($field, 'many', 'thisField');
            $thatField    = $this->definition->getSubTypeField($field, 'many', 'thatField');
            $queryBuilder = $this->database->createQueryBuilder();
            $queryBuilder
                ->select('`'.$thisField.'`')
                ->from($field)
                ->where('`'.$thatField.'` IN (?)')
                ->setParameter(0, array_column($params[$field], 'id'), Connection::PARAM_STR_ARRAY)
                ->groupBy('`'.$thisField.'`')
            ;
            $queryResult = $queryBuilder->execute();
            $manyResults = $queryResult->fetchAll(\PDO::FETCH_ASSOC);
            $manyIds     = array_merge($manyIds, array_column($manyResults, $thisField));

        }
        return $manyIds;
    }
protected function getManyIds ( array $ fields , array $ params ) { $ manyIds = [ ] ; foreach ( $ fields as $ field ) { $ thisField = $ this -> definition -> getSubTypeField ( $ field , 'many' , 'thisField' ) ; $ thatField = $ this -> definition -> getSubTypeField ( $ field , 'many' , 'thatField' ) ; $ queryBuilder = $ this -> database -> createQueryBuilder ( ) ; $ queryBuilder -> select ( '`' . $ thisField . '`' ) -> from ( $ field ) -> where ( '`' . $ thatField . '` IN (?)' ) -> setParameter ( 0 , array_column ( $ params [ $ field ] , 'id' ) , Connection :: PARAM_STR_ARRAY ) -> groupBy ( '`' . $ thisField . '`' ) ; $ queryResult = $ queryBuilder -> execute ( ) ; $ manyResults = $ queryResult -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; $ manyIds = array_merge ( $ manyIds , array_column ( $ manyResults , $ thisField ) ) ; } return $ manyIds ; }
Gets all possible many-to-many ids existing for this definition.

@param array $fields
the many field names to fetch for
@param $params
the parameters the possible many field values to fetch for
@return array
an array of this many-to-many ids
Gets all possible many - to - many ids existing for this definition .