init() public method

public init ( )
Beispiel #1
0
 public function init()
 {
     if ($this->timestampAttributeFormat === null) {
         $this->timestampAttributeFormat = 'yyyy-MM-dd';
     }
     if ($this->timestampAttribute === null) {
         $this->timestampAttribute = $this->sqlAttribute;
     }
     parent::init();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->format === null) {
         switch ($this->type) {
             case 'date':
                 $this->format = Yii::$app->formatter->dateFormat;
                 break;
             case 'time':
                 $this->format = Yii::$app->formatter->timeFormat;
                 break;
             case 'datetime':
                 $this->format = Yii::$app->formatter->datetimeFormat;
                 break;
         }
     }
     // if $this->format is a short format,
     // convert it to a pattern, so that DateValidator will respect $this->type.
     $this->format = FormatConverter::convertIcuShortFormatToPattern($this->format, $this->type, $this->locale);
     parent::init();
 }