Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function __construct($expression, $params = [], $config = [])
 {
     parent::__construct($expression, $params, $config);
     if ($this->query instanceof ActiveQuery) {
         $this->query->on(ActiveQuery::EVENT_ALIAS, function (Event $event) use($expression) {
             /* @var $query ActiveQuery */
             $query = $event->sender;
             $this->expression = str_replace('{a}', $query->getAlias(), $expression);
         });
         $this->expression = str_replace('{a}', $this->query->getAlias(), $expression);
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $time = isset($_SERVER['REQUEST_TIME_FLOAT']) ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime(true);
     $strtime = DateTimeFormatter::unixTimeToString($time, new DateTimeZone('Etc/UTC'));
     parent::__construct(Yii::$app->db->quoteValue($strtime));
 }