public function save($object) { if ($object->name == '') { throw new ApplicationTableException('Invalid name'); } if ($object->alias == '' || $object->alias != $this->app->string->sluggify($object->alias)) { throw new ApplicationTableException('Invalid slug'); } $new = !(bool) $object->id; $result = parent::save($object); // trigger save event $this->app->event->dispatcher->notify($this->app->event->create($object, 'application:saved', compact('new'))); return $result; }
public function save($object) { if ($object->name == '') { throw new SubmissionTableException('Invalid name'); } if ($object->alias == '' || $object->alias != $this->app->string->sluggify($object->alias)) { throw new SubmissionTableException('Invalid slug'); } if ($this->app->alias->submission->checkAliasExists($object->alias, $object->id)) { throw new SubmissionTableException('Slug already exists, please choose a unique slug'); } // sanatize trusted mode if ($object->access == false) { $object->getParams()->set('trusted_mode', false); } return parent::save($object); }
public function save($object) { if (!($application = $object->getApplication())) { throw new ItemTableException('Invalid application id'); } if (!is_string($object->type) || empty($object->type)) { throw new ItemTableException('Invalid type id'); } if ($object->name == '') { throw new ItemTableException('Invalid name'); } if ($object->alias == '' || $object->alias != $this->app->string->sluggify($object->alias)) { throw new ItemTableException('Invalid slug'); } if ($this->app->alias->item->checkAliasExists($object->alias, $object->id)) { throw new ItemTableException('Alias already exists, please choose a unique alias'); } $new = !(bool) $object->id; // trigger save event $this->app->event->dispatcher->notify($this->app->event->create($object, 'item:save', compact('new'))); $result = parent::save($object); // init vars $db = $this->database; $search_data = array(); foreach ($object->getElements() as $id => $element) { // get search data if ($data = $element->getSearchData()) { $search_data[] = "(" . $object->id . ", " . $db->quote($id) . ", " . $db->quote($data) . ")"; } } // delete old search data $query = "DELETE FROM " . ZOO_TABLE_SEARCH . " WHERE item_id = " . (int) $object->id; $db->query($query); // insert new search data if (count($search_data)) { $query = "INSERT INTO " . ZOO_TABLE_SEARCH . " VALUES " . implode(", ", $search_data); $db->query($query); } // save tags $this->app->table->tag->save($object); // trigger saved event $this->app->event->dispatcher->notify($this->app->event->create($object, 'item:saved', compact('new'))); return $result; }
public function save($object) { // auto update all comments of a joomla user, if name/email changed if ($object->user_id && ($row = $this->first(array('conditions' => array('user_id = ?', $object->user_id)))) && ($row->author != $object->author || $row->email != $object->email)) { // get database $db = $this->database; $query = "UPDATE " . $this->name . " SET author = " . $db->quote($object->author) . ", email = " . $db->quote($object->email) . " WHERE user_id = " . $object->user_id; $db->query($query); } $old_state = ''; if ($object->id) { $old_state = $this->get($object->id, true)->state; } $new = !(bool) $object->id; $result = parent::save($object); // trigger save event $this->app->event->dispatcher->notify($this->app->event->create($object, 'comment:saved', compact('new', 'old_state'))); return $result; }
public function save($object) { if ($object->name == '') { throw new CategoryTableException('Invalid name'); } if ($object->alias == '' || $object->alias != $this->app->string->sluggify($object->alias)) { throw new CategoryTableException('Invalid slug'); } if ($this->app->alias->category->checkAliasExists($object->alias, $object->id)) { throw new CategoryTableException('Slug already exists, please choose a unique slug'); } if (!is_numeric($object->parent)) { throw new CategoryTableException('Invalid parent id'); } $new = !(bool) $object->id; $result = parent::save($object); // trigger save event $this->app->event->dispatcher->notify($this->app->event->create($object, 'category:saved', compact('new'))); return $result; }
public function save($object) { $object->orderDate = $this->app->date->create($object->orderDate)->toSQL(); $result = parent::save($object); return $result; }
public function save($object) { $result = parent::save($object); return $result; }
public function save($object) { $new = !(bool) $object->id; // first save to get id if (empty($object->id)) { parent::save($object); } $result = parent::save($object); return $result; }