本文整理汇总了PHP中Object::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::update方法的具体用法?PHP Object::update怎么用?PHP Object::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveItem
public function saveItem($input)
{
$form = new AppForm();
$form = $input;
$values = $form->getValues();
$update = false;
if (isset($this->request->post['id'])) {
$id = $this->request->post['id'];
$update = true;
} else {
$id = 0;
}
try {
if ($update) {
$this->items->update($id, $values);
} else {
$id = $this->items->insert($values);
}
} catch (DibiException $e) {
$this->flashMessage('Error! ' . $e->getMessage(), 'err');
}
$this->cleanCache('application/system', 'categories');
$this->flashMessage('Item has been saved.', 'ok');
if ($form['save']->isSubmittedBy()) {
$this->redirect('edit', array('id' => $id));
} elseif ($form['add']->isSubmittedBy()) {
$this->redirect('add');
} else {
$this->redirect('default');
}
}
示例2: update
/**
* Simple update
*
* @param array $data
*
*/
public function update($data = NULL)
{
if ($data) {
$this->object()->extend($data);
} else {
$data = $this->getData();
}
if (isset($data[$this->primary])) {
unset($data[$this->primary]);
}
event('Db_ORM.update', $this, $data);
if ($result = $this->db->update($this->table, $data, array($this->primary => $this->{$this->primary}))) {
$this->cache($this->{$this->primary}, FALSE, array(), 0);
}
return $result;
}
示例3: update
/**
* Perform update on start document to save this relationship
*/
protected function update()
{
if (!$this->hasUniqueIndex() || $this->isNew()) {
return false;
}
$property = Relationship::REL_PREFIX . $this->getType();
// add id of end document and each properties for update set.
foreach ($this->getProperties(false) as $key => $value) {
$properties[$property . '.$.' . $key] = $value;
}
// Select de relationship by end document id and collection name
// It's have to be unique per relation type
$criteria = $this->getUniqueIndex();
unset($properties['_id']);
unset($properties['_collection']);
unset($properties['_class']);
$update = ['$set' => $properties];
$result = $this->start_doc->update($criteria, $update);
if ($result === true) {
$this->toggleProperties();
}
return $result;
}
示例4: update
public function update($id, $values)
{
return $this->gateway->update($this->getSingleUrl($id), $values);
}
示例5: testFactureFournisseurUpdate
/**
* testFactureFournisseurUpdate
*
* @param Object $localobject Supplier invoice
* @return int
*
* @depends testFactureFournisseurFetch
* The depends says test is run only if previous is ok
*/
public function testFactureFournisseurUpdate($localobject)
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject->note = 'New note after update';
$result = $localobject->update($user);
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
$this->assertLessThan($result, 0);
return $localobject;
}
示例6: testCompanyBankAccountOther
/**
* testCompanyBankAccountOther
*
* @param Object $localobject Bank account
* @return int
*
* @depends testCompanyBankAccountFetch
* The depends says test is run only if previous is ok
*/
public function testCompanyBankAccountOther($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->owner='New owner';
$result=$localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}
示例7: run_trigger
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file
* is inside directory core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, $user, $langs, $conf)
{
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
// Users
if ($action === 'PROJECT_CREATE') {
if (empty($object->array_options['options_color'])) {
dol_include_once('/scrumboard/lib/scrumboard.lib.php');
$object->array_options['options_color'] = '#' . scrumboard_random_color();
$object->update($user, 1);
}
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} else {
if ($action === 'TASK_CREATE') {
if (!empty($conf->global->SCRUM_ADD_TASKS_TO_GRID)) {
$object->array_options['options_grid_use'] = 1;
$object->update($user, 1);
}
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
}
}
return 0;
}
开发者ID:vinclar,项目名称:dolibarr_module_scrumboard,代码行数:35,代码来源:interface_99_modscrumboard_scrumboardtrigger.class.php
示例8: run_trigger
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file
* is inside directory core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, $user, $langs, $conf)
{
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
// Users
if ($action === 'PROJECT_CREATE') {
if (empty($object->array_options['options_color'])) {
dol_include_once('/scrumboard/lib/scrumboard.lib.php');
$object->array_options['options_color'] = '#' . scrumboard_random_color();
$object->update($user, 1);
}
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} else {
if ($action === 'TASK_CREATE') {
if (!empty($conf->global->SCRUM_ADD_TASKS_TO_GRID)) {
$object->array_options['options_grid_use'] = 1;
$object->update($user, 1);
$object->insertExtraFields();
}
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} else {
if ($action === 'ACTION_CREATE' || $action == 'ACTION_MODIFY') {
$fk_task = 0;
$object->fetchObjectLinked();
if (!empty($object->linkedObjectsIds['task'])) {
$row = each($object->linkedObjectsIds['task']);
$fk_task = $row[1];
}
$fk_project_task = GETPOST('fk_project_task');
if (!empty($fk_project_task)) {
list($fk_project, $fk_task) = explode('_', $fk_project_task);
if (!empty($fk_task)) {
if (!empty($object->linkedObjectsIds['task'])) {
$object->updateObjectLinked($fk_task, 'task');
} else {
$object->add_object_linked('task', $fk_task);
}
}
}
/*var_dump($object);
exit('!');
*/
}
}
}
return 0;
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_scrumboard,代码行数:59,代码来源:interface_98_modscrumboard_scrumboardtrigger.class.php