public function setData($data, $modified = true) { parent::setData($data, $modified); if ($this->days && !$this->start_date && !$this->end_date) { $first = reset($this->days); $end = end($this->days); $this->start_date = $first['date']; $this->end_date = $end['date']; } return $this; }
/** * @param $data * @param bool $modified * @return $this|KDatabaseRowAbstract */ public function setData($data, $modified = true) { parent::setData($data, $modified); if ($this->days && !$this->start_date && !$this->end_date) { $days = $this->days->toArray(); $first = reset($days); $end = end($days); $this->start_date = strtotime($first['date']); $this->end_date = strtotime($end['date']); } return $this; }