mirror of
https://github.com/slawkens/myaac.git
synced 2026-01-23 06:26:22 +01:00
OTS_Account: setCustomField - Use Account model to update
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
|
||||
*/
|
||||
|
||||
use MyAAC\Models\Account as AccountModel;
|
||||
use MyAAC\Models\AccountAction;
|
||||
|
||||
/**
|
||||
@@ -702,17 +703,11 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
*/
|
||||
public function setCustomField($field, $value)
|
||||
{
|
||||
if( !isset($this->data['id']) )
|
||||
{
|
||||
if( !isset($this->data['id']) ) {
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
// quotes value for SQL query
|
||||
if(!( is_int($value) || is_float($value) ))
|
||||
{
|
||||
$value = $this->db->quote($value);
|
||||
}
|
||||
$this->db->exec('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||
AccountModel::where('id', $this->data['id'])->update([$field => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user