Exemple #1
0
 public function findByField($field, $value = null, $columns = array('*'))
 {
     try {
         $collection = parent::findByField($field, $value, $columns);
         if ($collection->count() === 0) {
             throw new ModelNotFoundException();
         }
         if ($this->with_relation_count) {
             $collection = $this->setCountedFields($collection);
         }
         return $collection;
     } catch (ModelNotFoundException $e) {
         throw new RepositoryException('Entity is not found!', null, $e);
     }
 }