1
0
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:
SecretR
2013-10-06 18:03:49 +03:00
parent 055b26ac5c
commit e3c7337c64

View File

@@ -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;
}