예제 #1
0
 /**
  * @return	DefaultValue
  */
 public function __construct($value)
 {
     if (is_null($value) || is_scalar($value) || is_object($value) && is_callable(array($value, '__toString'))) {
         $this->value = $value;
     } else {
         $err = "Value must be a scalar or an objectect that implments ";
         $err .= "__toString";
         throw new Exception($err);
     }
     parent::__construct("default");
 }
예제 #2
0
파일: Key.php 프로젝트: kevinlondon/appfuel
 /**
  * @return	DefaultValue
  */
 public function __construct($name, $columns, $isUnique = false)
 {
     if (!empty($name)) {
         $this->setIndexName($name);
     }
     if (is_string($columns)) {
         $this->addColumn($columns);
     } else {
         if (is_array($columns)) {
             foreach ($columns as $column) {
                 $this->addColumn($column);
             }
         } else {
             $err = "columns must be a string or an array of strings";
             throw new Exception($err);
         }
     }
     $sqlPhrase = 'key';
     if (true === $isUnique) {
         $sqlPhrase = 'unique key';
     }
     parent::__construct($sqlPhrase);
 }