Scalr\Service\Aws\AbstractRepository::findBy PHP Метод

findBy() публичный Метод

Finds elements by required criteria.
public findBy ( array $criteria ) : ArrayObject
$criteria array An assoc array with search query. It looks like array (propertyname => value)
Результат ArrayObject Returns an list of entities which match criteria.
    public function findBy(array $criteria)
    {
        $result = new ArrayObject();
        $em = $this->getEntityManager();
        $storage = $em->getStorage($this->getReflectionClassName());
        foreach ($storage as $obj) {
            $c = true;
            foreach ($criteria as $propertyName => $value) {
                $fn = 'get' . ucfirst($propertyName);
                if ($obj->{$fn}() !== $value) {
                    $c = false;
                    break;
                }
            }
            if ($c === true) {
                $result->append($obj);
            }
        }
        return $result;
    }