Exemplo n.º 1
0
 /**
  * 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;
     }
 }