How to correctly save the date in Oracle database using yii2?
In the Oraklovsky table a field date in a date.
Model
public function behaviors() { return [ [ 'class' => AttributeBehavior::className(), 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['DATE'], ActiveRecord::EVENT_BEFORE_UPDATE => ['DATE'], ], 'value' => new Expression("TO_DATE('" //$this->DATE .Yii::$app->session->get('DATE') ."','YYYY-MM-DD HH24:MI:SS')"), ], ]; } The controller in the creation and editing actions use the entry to the session as it does not come out to get through $ this-> DATE in the model.
Yii::$app->session->set('DATE', $date ); The question is how to correctly save the date entered by the user without using the session crutch.