Ejemplo n.º 1
0
 /**
  * Constructor.
  *
  * Parameters meaning is a bit different than classic Exception class.
  *
  * @param string $message See \Exception::__construct().
  * @param string $query   The SQL query that caused error. It will be concat to exception
  * message.
  * @param string $previous See \Exception::__construct().
  */
 public function __construct($message, $query, \Exception $previous = null)
 {
     $s = 'A database error occured' . PHP_EOL;
     $s .= 'Error: ' . $message . PHP_EOL;
     if ($query) {
         $s .= 'SQL query: ' . $query . PHP_EOL;
     }
     parent::__construct($s, 0, $previous);
 }
 public function __construct($optionName, $optionString, \Exception $previous = null)
 {
     $error = 'Option "' . $optionName . '" is not well-formed:' . "\n" . 'Given option: ' . $optionString;
     parent::__construct($error, 0, $previous);
 }
Ejemplo n.º 3
0
 /**
  * Constructor.
  *
  * @param string $methodName The method the user tried to use.
  */
 public function __construct($methodName)
 {
     parent::__construct('You cannot use "' . $methodName . '" method because your model extends ReadOnlyModel.');
 }
Ejemplo n.º 4
0
 /**
  * Constructor.
  *
  * @param mixed $id ID of Model instance that user tried to retrieve.
  */
 public function __construct($id)
 {
     $id = is_array($id) ? '(' . implode(', ', $id) . ')' : $id;
     parent::__construct('Record not found with ID: "' . $id . '".');
 }