/** * Tests the save method * * @covers JTable::save * * @return void * * @since 12.3 */ public function testSave() { $this->object = $this->getMockBuilder('TableDbTestComposite') ->setConstructorArgs(array(TestCaseDatabase::$driver)) ->setMethods(array('bind', 'check', 'store', 'checkin', 'reorder', 'setError')) ->getMock(); $this->object->expects($this->once()) ->method('bind') ->with(array('id1' => 75, 'id2' => 75, 'title' => 'My testSave Title'), '') ->will($this->returnValue(true)); $this->object->expects($this->once()) ->method('check') ->with() ->will($this->returnValue(true)); $this->object->expects($this->once()) ->method('store') ->with() ->will($this->returnValue(true)); $this->object->expects($this->never()) ->method('reorder'); $this->object->save(array('id1' => 75, 'id2' => 75, 'title' => 'My testSave Title')); }
/** * Method to save Both the Parent Table & Child Table * params array * return boolean * (non-PHPdoc) * @see JTable::save() */ public function save($src, $orderingFilter = '', $ignore = '') { JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/tables'); $status = true; if (parent::save($src, $orderingFilter, $ignore)) { // after save parent save return primary key value // save the table only pk value exists if ($this->taxprofile_id) { if (isset($src['tax-to-taxrule-row']) && count($src['tax-to-taxrule-row'])) { $trTable = JTable::getInstance('taxrule', 'Table'); $status = true; foreach ($src['tax-to-taxrule-row'] as $taxrate) { $taxrate['taxprofile_id'] = $this->taxprofile_id; try { $trTable->save($taxrate); } catch (Exception $e) { $status = false; } if (!$status) { break; } } } } } return $status; }
function save($data) { if (!parent::save($data)) { $this->setError($this->getError()); return false; } return true; }
/** * Override save method to not create duplicates * * @param mixed $src An associative array or object to bind to the JTable instance. * @param string $orderingFilter Filter for the order updating * @param mixed $ignore An optional array or space separated list of properties * @return boolean True on success. **/ public function save($src, $orderingFilter = '', $ignore = '') { $this->load($src); if ($this->get('id')) { $result = true; } else { $result = parent::save($src, $orderingFilter, $ignore); } return $result; }
public function save($src, $orderingFilter = '', $ignore = '') { $status = true; JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/tables/'); if (parent::save($src, $orderingFilter, $ignore)) { if ($this->geozone_id) { $grtable = JTable::getInstance('geozonerule', 'Table'); $status = true; foreach ($src['zone_to_geo_zone'] as $georule) { $georule['geozone_id'] = $this->geozone_id; try { $grtable->save($georule); } catch (Exception $e) { $status = false; } if (!$status) { break; } } } } return $status; }
public function save($src, $orderingFilter = '', $ignore = '') { $status = true; JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/tables'); if (parent::save($src, $orderingFilter, $ignore)) { if ($this->option_id) { if (isset($src['option_value']) && count($src['option_value'])) { $ovTable = JTable::getInstance('optionvalues', 'Table'); $status = true; foreach ($src['option_value'] as $optionvalue) { $optionvalue['option_id'] = $this->option_id; if (!$ovTable->save($optionvalue)) { $status = false; } } } } } return $status; }
/** * Method to provide a shortcut to binding, checking and storing a JTable * instance to the database table. The method will check a row in once the * data has been stored and if an ordering filter is present will attempt to * reorder the table rows based on the filter. The ordering filter is an instance * property name. The rows that will be reordered are those whose value matches * the JTable instance for the property specified. * * @param mixed $src An associative array or object to bind to the JTable instance. * @param string $orderingFilter Filter for the order updating * @param mixed $ignore An optional array or space separated list of properties * to ignore while binding. * * @return boolean True on success. * * @link http://docs.joomla.org/JTable/save * @since 11.1 */ public function save($src, $orderingFilter = '', $ignore = '') { return parent::save($src, $orderingFilter, $ignore); }
function save($data) { unset($this->displayField); parent::save($data); }
/** * check for cache remove. **/ function save($source, $order_filter = '', $ignore = '') { $this->deleteCache(CCache::METHOD_SAVE); return parent::save($source, $order_filter, $ignore); }