mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Models could use load() without primary id
This commit is contained in:
@@ -1453,10 +1453,11 @@ class e_model extends e_object
|
||||
|
||||
/**
|
||||
* Generic load data from DB
|
||||
* @param mixed $id
|
||||
* @param boolean $force
|
||||
* @return e_model
|
||||
*/
|
||||
public function load($id, $force = false)
|
||||
public function load($id = null, $force = false)
|
||||
{
|
||||
if(!$force && $this->getId())
|
||||
{
|
||||
@@ -1468,8 +1469,8 @@ class e_model extends e_object
|
||||
$this->setData(array())
|
||||
->_clearCacheData();
|
||||
}
|
||||
$id = e107::getParser()->toDB($id);
|
||||
if(!$id)
|
||||
if($id) $id = e107::getParser()->toDB($id);
|
||||
if(!$id && !$this->getParam('db_query'))
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user