本文整理汇总了PHP中JTable::save方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::save方法的具体用法?PHP JTable::save怎么用?PHP JTable::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::save方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSave
/**
* 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'));
}
示例2: save
/**
* 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;
}
示例3: save
function save($data)
{
if (!parent::save($data)) {
$this->setError($this->getError());
return false;
}
return true;
}
示例4: save
/**
* 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;
}
示例5: save
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;
}
示例6: save
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;
}
示例7: save
/**
* 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);
}
示例8: save
function save($data)
{
unset($this->displayField);
parent::save($data);
}
示例9: save
/**
* check for cache remove.
**/
function save($source, $order_filter = '', $ignore = '')
{
$this->deleteCache(CCache::METHOD_SAVE);
return parent::save($source, $order_filter, $ignore);
}