Example #1
0
 public function buildCustomCriteria($criteriaName, $baseCriteria)
 {
     $customCriteria = ucfirst($criteriaName);
     $customCriteriaClass = $this->config->getCustomCriteriaClass($baseCriteria->getEntityName(), $customCriteria);
     if (!class_exists($customCriteriaClass)) {
         throw new RuntimeException(sprintf('Wrong criteria %s. Class %s does not exists.', $customCriteria, $customCriteriaClass));
     }
     $customCriteriaInstance = new $customCriteriaClass();
     if (!is_callable($customCriteriaInstance)) {
         throw new RuntimeException(sprintf('Wrong criteria %s. Object of type %s is not callable.', $customCriteria, $customCriteriaClass));
     }
     return $customCriteriaInstance;
 }