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