TimestampBehavior::class, 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', 'value' => new Expression('NOW()'), ], ]; } /** * {@inheritdoc} */ public static function tableName() { return 'file_entity'; } /** * {@inheritdoc} */ public function rules() { return [ [['file_id', 'entity_type', 'entity_id', 'status'], 'integer'], [['created_at', 'updated_at'], 'safe'], [['file_id'], 'exist', 'skipOnError' => true, 'targetClass' => File::className(), 'targetAttribute' => ['file_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'file_id' => 'File ID', 'entity_type' => 'Entity Type', 'entity_id' => 'Entity ID', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => 'Status', ]; } /** * @return \yii\db\ActiveQuery */ public function getFile() { return $this->hasOne(File::className(), ['id' => 'file_id']); } }