public static function findOneEntityByCriteria(array $criteria = [], array $exclude = [])
    {
        $class = static::class;

        /** @var EntityRepository $obj_collection */
        $obj_collection = new $class();
        $obj_collection->setLimit(1);

        foreach ($criteria as $k => $v) {
            $obj_collection->addSimpleWhereField($k, $v);
        }

        foreach ($exclude as $k => $v) {
            $obj_collection->addWhereFieldIsNot($k, $v);
        }

        return $obj_collection->getFirstObjectFromCollection();
    }
public static function findOneEntityByCriteria(array $criteria = [], array $exclude = [])
    {
        $class = static::class;

        /** @var EntityRepository $obj_collection */
        $obj_collection = new $class();
        $obj_collection->setLimit(1);

        foreach ($criteria as $k => $v) {
            $obj_collection->addSimpleWhereField($k, $v);
        }

        foreach ($exclude as $k => $v) {
            $obj_collection->addWhereFieldIsNot($k, $v);
        }

        return $obj_collection->getFirstObjectFromCollection();
    }
public static function findOneEntityByCriteria ( array $ criteria = [ ] , array $ exclude = [ ] ) { $ class = static :: class ; /** @var EntityRepository $obj_collection */ $ obj_collection = new $ class ( ) ; $ obj_collection -> setLimit ( 1 ) ; foreach ( $ criteria as $ k => $ v ) { $ obj_collection -> addSimpleWhereField ( $ k , $ v ) ; } foreach ( $ exclude as $ k => $ v ) { $ obj_collection -> addWhereFieldIsNot ( $ k , $ v ) ; } return $ obj_collection -> getFirstObjectFromCollection ( ) ; }
Return one Entity by array of criteria

@param array $criteria select AND
@param array $exclude  select NOT

@return Entity|NULL
Return one Entity by array of criteria