Exemplo n.º 1
0
 public function __construct(array $data)
 {
     /*
      * Инициализируем поля
      */
     parent::__construct($data);
     /*
      * Определим тип поля ($coltype)
      */
     switch ($this->getDataType()) {
         //ЧИСЛОВЫЕ
         case 'tinyint':
             if (starts_with($this->getName(), 'b_')) {
                 $this->coltype = self::TYPE_BIT;
                 break;
             }
         case 'int':
             if (starts_with($this->getName(), 'dt_')) {
                 $this->coltype = self::TYPE_INT_DATE;
                 break;
             }
             $this->coltype = self::TYPE_INT;
             break;
             //ТЕКСТОВЫЕ
         //ТЕКСТОВЫЕ
         case 'char':
             if ($this->getCharMaxlen() == 1) {
                 $this->coltype = self::TYPE_CHAR;
                 break;
             }
         case 'varchar':
             if ($this->getCharMaxlen() <= 255) {
                 if (starts_with($this->getName(), 'dt_')) {
                     $this->coltype = self::TYPE_STRING_DATE;
                 } else {
                     $this->coltype = self::TYPE_STRING;
                 }
                 break;
             }
         case 'text':
             $this->coltype = self::TYPE_TEXT;
             break;
         default:
             PsUtil::raise('Неизвестный тип данных для столбца {}.{}: {}.', $this->getTableName(), $this->getName(), $this->getDataType());
             break;
     }
 }
Exemplo n.º 2
0
 public function __construct(array $data, TestingDB $testing)
 {
     parent::__construct($data);
     $this->testing = $testing;
 }
Exemplo n.º 3
0
 public final function __construct(array $data)
 {
     parent::__construct($data);
 }
Exemplo n.º 4
0
 /**
  * Переопределим конструктоп для проверки наличия всех нужных нам свойств.
  * Данная проверка нужна, чтобы не забыть определить все свойство, так как у нас два источника элементов галереи - база и файловая система.
  */
 function __construct(array $data)
 {
     foreach (PsUtil::getClassConsts(__CLASS__, 'DBPROP_') as $propName) {
         check_condition(array_key_exists($propName, $data), "Required property {$propName} not given for " . __CLASS__);
     }
     parent::__construct($data);
 }
Exemplo n.º 5
0
 public function __construct($type, $ident)
 {
     parent::__construct(is_array($ident) ? $ident : array('ident' => $ident));
     $this->postType = $type;
 }
Exemplo n.º 6
0
 public final function __construct(DiscussionSettings $settings, array $data)
 {
     parent::__construct($data);
     $this->SETTINGS = $settings;
     /*
      * Обратимся к пользователю, чтобы потом, в процессе обращения к аватару
      * пользователя, все они были загружены батчем.
      */
     $this->getUser();
 }