/**
  *
  */
 public static function getInstance()
 {
     if (is_null(MetaDriverFactory::$instance)) {
         MetaDriverFactory::$instance = new MetaDriverFactory();
     }
     return MetaDriverFactory::$instance;
 }
Example #2
0
 /**
  *
  */
 public function __construct($dbkey = "default")
 {
     $obj = PdoPool::getInstance();
     $pdo_info = $obj->getPdoInfo($dbkey);
     $this->db_key = $pdo_info["key"];
     $this->pdo = $pdo_info["pdo"];
     $this->pdo_config = $pdo_info["config"];
     $this->table_name = SInflector::tableize(get_class($this));
     $meta_driver = MetaDriverFactory::getInstance();
     $this->props = $meta_driver->getColumns($this->pdo, $this->table_name);
     $this->column_names = array_keys($this->props);
     $this->vals = array();
     foreach ($this->column_names as $name) {
         $this->vals[$name] = array("value" => null, "is_updated" => false);
     }
     foreach ($this->primary_key as $pkey) {
         if (!in_array($pkey, $this->column_names, true)) {
             $msg = "No Such property found: " . $pkey;
             throw new NoSuchPropertyError($msg);
         }
     }
 }