예제 #1
0
파일: Generator.php 프로젝트: tolik505/bl
 /**
  * @param \yii\db\TableSchema $table the table schema
  * @param \yii\db\TableSchema $translationTable the table schema
  * @return array
  */
 public function getTranslationAttributes($table, $translationTable)
 {
     if (!$translationTable) {
         return [];
     }
     $attributes = [];
     foreach ($translationTable->columns as $column) {
         if (in_array($column->name, $table->getColumnNames(), true)) {
             $attributes[] = $column->name;
         }
     }
     return $attributes;
 }
예제 #2
0
 /**
  * @param \yii\db\TableSchema $table the table schema
  *
  * @return string[]
  */
 protected function generateTimestamp($table)
 {
     $createdAt = $table->getColumn($this->createdAtColumn) !== null ? $this->createdAtColumn : false;
     $updatedAt = $table->getColumn($this->updatedAtColumn) !== null ? $this->updatedAtColumn : false;
     if ($this->useTimestampBehavior && ($createdAt || $updatedAt)) {
         return ['createdAtAttribute' => $createdAt, 'updatedAtAttribute' => $updatedAt];
     }
     return [];
 }