Exemple #1
0
 /**
  * Create new instance of Matheon_Model_Document.
  *
  * @param mixed $docId
  *
  * @throws Application_Exception
  */
 public function __construct($docId)
 {
     $this->_log = Zend_Registry::get('Zend_Log');
     if (empty($docId)) {
         $error = "Empty docId given.";
         $this->_log->err($error);
         throw new Application_Exception($error);
     }
     if (!preg_match('/\\d+/', $docId) or $docId <= 0) {
         $error = "No or invalid docId given (docId:{$docId}).";
         $this->_log->err($error);
         throw new Application_Exception($error);
     }
     $document = new Opus_Document($docId);
     if ($document->isNewRecord() or is_null($document->getId())) {
         $error = "Document '{$docId}' has not been stored.";
         $this->_log->err($error);
         throw new Application_Exception($error);
     }
     $this->_document = $document;
 }