示例#1
0
文件: Model.php 项目: gotcms/gotcms
 /**
  * Initiliaze from id
  *
  * @param integer $identifier Identifier
  *
  * @return \Gc\Script\Model
  */
 public static function fromIdentifier($identifier)
 {
     $scriptTable = new Model();
     $row = $scriptTable->fetchRow($scriptTable->select(array('identifier' => $identifier)));
     $scriptTable->events()->trigger(__CLASS__, 'before.load', $scriptTable);
     if (!empty($row)) {
         $scriptTable->setData((array) $row);
         $scriptTable->setOrigData();
         $scriptTable->events()->trigger(__CLASS__, 'after.load', $scriptTable);
         return $scriptTable;
     } else {
         $scriptTable->events()->trigger(__CLASS__, 'after.load.failed', $scriptTable);
         return false;
     }
 }