Example #1
0
 function Orm($name = null, $table = null, $primaryKey = null)
 {
     $this->_assignLibraries();
     $this->_loadHelpers();
     if ($name == null) {
         if ($this->name == null) {
             $this->name = ucfirst(singular(get_class($this)));
         }
     } else {
         $this->name = $name;
     }
     if ($this->alias === null) {
         $this->alias = $this->name;
     }
     if ($table == null) {
         if ($this->table == null) {
             $this->table = plural($this->name);
         }
     } else {
         $this->table = $table;
     }
     $this->table = $this->prefix . $this->table;
     if ($primaryKey == null) {
         if ($this->primaryKey == null) {
             $this->primaryKey = 'id';
         }
     } else {
         $this->primaryKey = $primaryKey;
     }
     Registry::addObject($this->alias, $this);
     $this->createLinks();
 }