Ejemplo n.º 1
0
 public function __construct($columns, $name = null)
 {
     if (empty($name)) {
         $name = 'key_' . uniqid();
     }
     parent::__construct($columns, $name);
 }
Ejemplo n.º 2
0
 public function __construct(string $name, array $columns, string $schema, string $table, string $column)
 {
     parent::__construct(Constraint::TYPE_FOREIGN, $name, $columns);
     $this->schema = $schema;
     $this->table = $table;
     $this->column = $column;
 }
Ejemplo n.º 3
0
 public function __construct($value)
 {
     if (!is_bool($value)) {
         throw new \InvalidArgumentException("The value of a UniqueItems constraint must be a boolean");
     }
     parent::__construct($value);
 }
Ejemplo n.º 4
0
 public function __construct($value)
 {
     if (empty($value)) {
         $this->throwException("TypeException", "The value for a {$this->name} Constraint must not be zero");
     }
     parent::__construct($value);
 }
Ejemplo n.º 5
0
 /**
  * Constructs a new index.
  *
  * @param string|null $name the name of the index
  * @param string|null $table the table for which the index should be created
  * @param boolean $unique <code>true</code> for a unique index
  * @param array $fields an array of fields for which this index is created
  */
 public function __construct($name = null, $table = null, $unique = true, $fields = array())
 {
     assert(is_null($name) || is_string($name));
     assert(is_null($table) || is_string($table));
     assert(is_bool($unique));
     assert(is_array($fields));
     $this->unique = $unique;
     $this->fields = $fields;
     parent::__construct($name, $table);
 }
Ejemplo n.º 6
0
 public function __construct($columns, $references, $on_delete = null, $on_update = null, $name = null)
 {
     parent::__construct($columns, $name);
     $this->setReferences($references);
     if ($on_delete) {
         $this->setOnDelete($on_delete);
     }
     if ($on_update) {
         $this->setOnUpdate($on_update);
     }
 }
Ejemplo n.º 7
0
 public function __construct($value)
 {
     if (!is_array($value)) {
         throw new \InvalidArgumentException("The value of a Required constraint must be an array");
     }
     // parse the array to make sure only string values are used
     foreach ($value as $key => $field) {
         if (!is_string($field)) {
             throw new \InvalidArgumentException("The element for key: {$key} was not a string");
         }
     }
     if (empty($value)) {
         throw new \InvalidArgumentException("The required field array did not contain any string values");
     }
     parent::__construct($value);
 }
Ejemplo n.º 8
0
 /**
  * Constructor.
  *
  * @param mixed $value
  * @param array $options
  */
 public function __construct($value, $options = array())
 {
     $options = lAtts(array('message' => 'should_be_false'), $options, false);
     parent::__construct($value, $options);
 }
Ejemplo n.º 9
0
 function __construct($var1, $var2, $strength)
 {
     parent::__construct($strength);
     $this->v1 = $var1;
     $this->v2 = $var2;
     $this->direction = Direction::NONE;
     $this->addConstraint();
 }
Ejemplo n.º 10
0
 public function __construct($name, $columns)
 {
     parent::__construct(Constraint::TYPE_UNIQUE, $name, $columns);
 }
Ejemplo n.º 11
0
 function __construct($var1, $var2, $strength)
 {
     Constraint::__construct($strength);
     $this->v1 = $var1;
     $this->v2 = $var2;
     $this->direction = $this->nodirection;
     $this->addConstraint();
 }
Ejemplo n.º 12
0
 /**
  * Constructor.
  *
  * @param mixed $value
  * @param array $options
  */
 public function __construct($value, $options = array())
 {
     $options = lAtts(array('choices' => array(), 'allow_blank' => false, 'message' => 'unknown_choice'), $options, false);
     parent::__construct($value, $options);
 }
Ejemplo n.º 13
0
 public function __construct(string $name, array $columns)
 {
     parent::__construct(Constraint::TYPE_PRIMARY, $name, $columns);
 }