/** * Initialize from id * * @param integer $tabId Tab id * * @return \Gc\Tab\Model */ public static function fromId($tabId) { $tabTable = new Model(); $row = $tabTable->fetchRow($tabTable->select(array('id' => (int) $tabId))); $tabTable->events()->trigger(__CLASS__, 'before.load', $tabTable); if (!empty($row)) { $tabTable->setData((array) $row); $tabTable->setOrigData(); $tabTable->events()->trigger(__CLASS__, 'after.load', $tabTable); return $tabTable; } else { $tabTable->events()->trigger(__CLASS__, 'after.load.failed', $tabTable); return false; } }