update() публичный Метод

Joins in UPDATE are supported only in MySQL
public update ( $data ) : integer
Результат integer number of affected rows
Пример #1
0
 public function update($data, $forceRegenerateTimes = FALSE)
 {
     parent::update($data);
     if ($forceRegenerateTimes || rand(0, 100) < 10) {
         $this->generateAllTimes();
     }
 }
Пример #2
0
 public function update($data)
 {
     $builder = $this->sqlBuilder;
     $this->sqlBuilder = new SqlBuilder($this);
     $this->where($this->column, $this->active);
     $return = parent::update($data);
     $this->sqlBuilder = $builder;
     return $return;
 }
Пример #3
0
 public function update($data)
 {
     $where = $this->where;
     $this->where[0] = "{$this->delimitedColumn} = " . $this->connection->quote($this->active);
     $return = parent::update($data);
     $this->where = $where;
     return $return;
 }
Пример #4
0
 public function update($data, $checkData = FALSE)
 {
     if ($checkData) {
         $coords = Geolocation::getCoordsFromText($data['map_coords']);
         $data['lat'] = $coords[0];
         $data['lon'] = $coords[1];
         //$to_code = isset($data['locality_nickname']) ? $data['name']." ".$data['locality_nickname']." ".$data['locality_id'] : $data['name']." ".$data['locality_id'];
         //$data['code'] = $data['code'] !=''  ? $data['code']  : \Nette\Utils\Strings::webalize($to_code);
         $data['code'] = $data['code'] != '' ? $data['code'] : \Nette\Utils\Strings::webalize($data['name']);
         if (isset($data['stroller'])) {
             $data['stroller'] = $data['stroller'] == 1 ? 1 : 0;
         }
         if (isset($data['visible'])) {
             $data['visible'] = $data['visible'] == 1 ? 1 : 0;
         }
         if (isset($data['approved'])) {
             $data['approved'] = $data['approved'] == 1 ? 1 : 0;
         }
         if (isset($data['ad_onhomepage'])) {
             $data['ad_onhomepage'] = $data['ad_onhomepage'] == 1 ? 1 : 0;
         }
         if (isset($data['ad'])) {
             $data['ad'] = $data['ad'] == 1 ? 1 : 0;
         }
         if (isset($data['show_in_catalogue'])) {
             $data['show_in_catalogue'] = $data['show_in_catalogue'] == 1 ? 1 : 0;
         }
         if (isset($data['show_in_calendar'])) {
             $data['show_in_calendar'] = $data['show_in_calendar'] == 1 ? 1 : 0;
         }
         $data['changed'] = new \Nette\DateTime();
         //$data['ad_shire'] = isset($data['ad_shire']) && $data['ad_shire'] == 0 ? null : $data['ad_shire'];
         //$data['ad_category'] = isset($data['ad_category']) && $data['ad_category'] == 0 ? null : $data['ad_category'];
         $cats = $data['categories'];
         unset($data['categories']);
         $this->setCategories($data['id'], $cats);
     }
     parent::update($data);
 }
Пример #5
0
 function update($data)
 {
     $condition = array($this->where, $this->parameters);
     $this->where[0] = "{$this->delimitedColumn} = ?";
     $this->parameters[0] = $this->active;
     $return = parent::update($data);
     list($this->where, $this->parameters) = $condition;
     return $return;
 }
Пример #6
0
 /**
  * Updates all rows in result set.
  *
  * Joins in UPDATE are supported only in MySQL
  *
  * @param array|\Traversable $data ($column => $value)
  * @return int number of affected rows
  * @throws \Nette\InvalidArgumentException
  */
 public function update($data)
 {
     return $this->selection->update($data);
 }
Пример #7
0
 public function update($data, $checkData = FALSE)
 {
     if ($checkData) {
         $data['code'] = Nette\Utils\Strings::webalize($data['subject_name'] . " " . $data['name']);
     }
     $coords = Geolocation::getCoordsFromText($data['subject_gps']);
     $data['lat'] = $coords[0];
     $data['lon'] = $coords[1];
     $data['last_edit_id'] = isset($this->context->user->id) ? $this->context->user->id : NULL;
     parent::update($data);
 }
Пример #8
0
 public function update($data)
 {
     parent::update($data);
 }