Nextras\Orm\Collection\ICollection::findBy PHP Method

findBy() public method

Returns new instance of collection.
public findBy ( array $where ) : Nextras\Orm\Collection\ICollection
$where array
return Nextras\Orm\Collection\ICollection
    public function findBy(array $where);

Usage Example

 public function getIterator(IEntity $parent, ICollection $collection)
 {
     if ($this->metadata->relationship->isMain) {
         $relationshipData = $this->mapper->getRelationshipDataStorage($this->metadata->name);
         $ids = isset($relationshipData[$parent->id]) ? array_keys($relationshipData[$parent->id]) : [];
     } else {
         $ids = [];
         $parentId = $parent->id;
         $relationshipData = $this->mapper->getRelationshipDataStorage($this->metadata->relationship->property);
         foreach ($relationshipData as $id => $parentIds) {
             if (isset($parentIds[$parentId])) {
                 $ids[] = $id;
             }
         }
     }
     $data = $collection->findBy(['id' => $ids])->fetchAll();
     return new EntityIterator($data);
 }
All Usage Examples Of Nextras\Orm\Collection\ICollection::findBy