Beispiel #1
0
 /**
  * The object constructor takes its name and identifier,
  * (the parameter is not required), if absent,
  * there will be created a new object. If ORM lacks the object with the specified
  * identifier, an Exception will show up
  * Using this method is highly undesirable,
  * the factory method Db_Object::factory() is more advisable to use
  * @param string $name
  * @param bool|int $id - optional
  * @throws Exception
  */
 public function __construct($name, $id = false)
 {
     $this->_name = strtolower($name);
     $this->_id = $id;
     $this->_config = Db_Object_Config::getInstance($name);
     $this->_primaryKey = $this->_config->getPrimaryKey();
     $this->_model = Model::factory($name);
     $this->_acl = $this->_config->getAcl();
     if ($this->_id) {
         $this->_checkCanRead();
         $this->_loadData();
     } else {
         if ($this->_acl && !static::$_disableAclCheck) {
             $this->_checkCanCreate();
         }
     }
 }