public function __construct($model, $filter)
 {
     if (is_array($filter)) {
         $filter = json_encode($filter);
     }
     parent::__construct(sprintf("Could not find model for '%s' with '%s'.", $model, $filter));
 }
 public function __construct()
 {
     parent::__construct('Entity was not found.');
 }
 /**
  * Adds support for magic finders.
  *
  * @return array|object The found entity/entities.
  * @throws BadMethodCallException  If the method called is an invalid find* method
  *                                 or no find* method at all and therefore an invalid
  *                                 method call.
  */
 public function __call($method, $arguments)
 {
     if (substr($method, 0, 6) == 'findBy') {
         $by = substr($method, 6, strlen($method));
         $method = 'findBy';
     } else {
         if (substr($method, 0, 9) == 'findOneBy') {
             $by = substr($method, 9, strlen($method));
             $method = 'findOneBy';
         } else {
             throw new \BadMethodCallException("Undefined method '{$method}'. The method name must start with " . "either findBy or findOneBy!");
         }
     }
     if (!isset($arguments[0])) {
         throw ORMException::findByRequiresParameter($method . $by);
     }
     $fieldName = lcfirst(\Doctrine\Common\Util\Inflector::classify($by));
     if ($this->_class->hasField($fieldName)) {
         return $this->{$method}(array($fieldName => $arguments[0]));
     } else {
         throw ORMException::invalidFindByCall($this->_entityName, $fieldName, $method . $by);
     }
 }
Esempio n. 4
0
 public function __construct()
 {
     parent::__construct('No result was found for query although at least one row was expected.');
 }
Esempio n. 5
0
 public function __construct($msg, $entity)
 {
     parent::__construct($msg);
     $this->entity = $entity;
 }
 public function __construct($model)
 {
     parent::__construct(sprintf("Could not destroy '%s'. Either there was no model to destroy " . "or you destroyed more than one model. Are you sure the model " . "was actually saved to the database in the first place?", $model));
 }
Esempio n. 7
0
 /**
  * Ensures that this Configuration instance contains settings that are
  * suitable for a production environment.
  *
  * @throws ORMException If a configuration setting has a value that is not
  *                      suitable for a production environment.
  */
 public function ensureProductionSettings()
 {
     if (!$this->_attributes['queryCacheImpl']) {
         throw ORMException::queryCacheNotConfigured();
     }
     if (!$this->_attributes['metadataCacheImpl']) {
         throw ORMException::metadataCacheNotConfigured();
     }
     if ($this->_attributes['autoGenerateProxyClasses']) {
         throw ORMException::proxyClassesAlwaysRegenerating();
     }
 }
 public function __construct()
 {
     parent::__construct('Entity was found although one item was expected.');
 }
 public function __construct($message, $code = 0, Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
 public function __construct($model, $attr, $value)
 {
     parent::__construct(sprintf("You tried to set the invalid value '%s' for the '%s' relation " . "on the '%s' model. In general, relationships only support " . "assignment with collections, queries, and individual models.", $value, $attr, $model));
 }
 /**
  * Constructor.
  */
 public function __construct($class)
 {
     parent::__construct("Entity of type '{$class}' was not found.");
 }