示例#1
0
文件: Table.php 项目: nrocy/phactory
 public function __construct($singular_name, $pluralize = true)
 {
     $this->_db_util = Phactory_DbUtilFactory::getDbUtil();
     $this->_singular = $singular_name;
     if ($pluralize) {
         $this->_name = Phactory_Inflector::pluralize($singular_name);
     } else {
         $this->_name = $singular_name;
     }
 }
示例#2
0
 public function recall()
 {
     $db_util = Phactory_DbUtilFactory::getDbUtil();
     $db_util->disableForeignKeys();
     try {
         $sql = "DELETE FROM {$this->_table->getName()}";
         Phactory::getConnection()->exec($sql);
     } catch (Exception $e) {
     }
     foreach ($this->_associations as $association) {
         if ($association instanceof Phactory_Association_ManyToMany) {
             try {
                 $sql = "DELETE FROM {$association->getJoinTable()}";
                 Phactory::getConnection()->exec($sql);
             } catch (Exception $e) {
             }
         }
     }
     $db_util->enableForeignKeys();
 }