/** * @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; }
/** * @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 []; }