src/Pok/PoolDBM/Persisters/ModelBuilder.php
protected function getManagersPerCollection(array $referenceModels, array $fields = array())
    {
        $this->collections->clean();

        if (empty($fields)) {
            return;
        }

        foreach ($this->class->getAssociationDefinitions() as $assoc) {
            $compatible = $assoc->getCompatible();

            if (!empty($compatible) && !in_array($this->class->getManagerIdentifier(), $compatible)) {
                continue;
            }

            foreach ($referenceModels as $referenceModel) {
                $property = $assoc->getReferenceField($this->class->getManagerIdentifier());

                if (!in_array($property, $fields)) {
                    continue;
                }

                /** @var null|object|ArrayCollection $coll */
                $coll = call_user_func(array($referenceModel, 'get' . ucfirst($property)));

                if (null === $coll || $assoc->isMany() && $coll->isEmpty()) {
                    continue;
                }

                $this->collections->append(new CollectionCenter($assoc, $this->manager->getClassMetadata($assoc->getTargetMultiModel()), $coll, $this->class->getIdentifierValue($referenceModel)));
            }
        }
    }
protected function getManagersPerCollection(array $referenceModels, array $fields = array())
    {
        $this->collections->clean();

        if (empty($fields)) {
            return;
        }

        foreach ($this->class->getAssociationDefinitions() as $assoc) {
            $compatible = $assoc->getCompatible();

            if (!empty($compatible) && !in_array($this->class->getManagerIdentifier(), $compatible)) {
                continue;
            }

            foreach ($referenceModels as $referenceModel) {
                $property = $assoc->getReferenceField($this->class->getManagerIdentifier());

                if (!in_array($property, $fields)) {
                    continue;
                }

                /** @var null|object|ArrayCollection $coll */
                $coll = call_user_func(array($referenceModel, 'get' . ucfirst($property)));

                if (null === $coll || $assoc->isMany() && $coll->isEmpty()) {
                    continue;
                }

                $this->collections->append(new CollectionCenter($assoc, $this->manager->getClassMetadata($assoc->getTargetMultiModel()), $coll, $this->class->getIdentifierValue($referenceModel)));
            }
        }
    }
protected function getManagersPerCollection ( array $ referenceModels , array $ fields = array ( ) ) { $ this -> collections -> clean ( ) ; if ( empty ( $ fields ) ) { return ; } foreach ( $ this -> class -> getAssociationDefinitions ( ) as $ assoc ) { $ compatible = $ assoc -> getCompatible ( ) ; if ( ! empty ( $ compatible ) && ! in_array ( $ this -> class -> getManagerIdentifier ( ) , $ compatible ) ) { continue ; } foreach ( $ referenceModels as $ referenceModel ) { $ property = $ assoc -> getReferenceField ( $ this -> class -> getManagerIdentifier ( ) ) ; if ( ! in_array ( $ property , $ fields ) ) { continue ; } /** @var null|object|ArrayCollection $coll */ $ coll = call_user_func ( array ( $ referenceModel , 'get' . ucfirst ( $ property ) ) ) ; if ( null === $ coll || $ assoc -> isMany ( ) && $ coll -> isEmpty ( ) ) { continue ; } $ this -> collections -> append ( new CollectionCenter ( $ assoc , $ this -> manager -> getClassMetadata ( $ assoc -> getTargetMultiModel ( ) ) , $ coll , $ this -> class -> getIdentifierValue ( $ referenceModel ) ) ) ; } } }
Returns list of collection.

@param array $referenceModels
@param array $fields          List of fields prime (optional)

@return void
Returns list of collection .