예제 #1
0
 protected function _createAndSave($type, $parent, $data, $callback = NULL)
 {
     $init = $this->_initFileData($type, $data, $parent->id(), $parent->_getFsId());
     $entity = $this->_fileStorage->createObject($init);
     try {
         $this->_initFileAccess($entity);
         if ($callback) {
             call_user_func($callback, $entity);
         }
         $entity->save();
     } catch (RM_Db_Exception_ConstraintViolation $e) {
         M('Trace')->trace('ofs', "Failed to create entity: " . $e->__toString());
         // this should remove created file
         $entity->delete();
         // here we can clean permission if needed
         throw new RM_ObjectFs_Exception_FileExists($parent, $entity);
     }
     return $entity;
 }
예제 #2
0
 /**
  *	Create mail variable object.
  *
  *	@param		name			string		variable name
  *	@param		mail_type_id	string		mail type identifier
  *
  *	@return		RM_Store_Object
  */
 public function createVariable($name)
 {
     return $this->_variableStorage->createObject(array('name' => $name, 'mail_type_id' => ''));
 }
예제 #3
0
파일: Type.class.php 프로젝트: evilgeny/bob
 /**
  *	Create template object connected with current mail type.
  *
  *	@return		RM_MailTemplate_Template
  */
 public function createTemplate()
 {
     return $this->_templateStorage->createObject(array('mail_type_id' => $this->id(), 'active' => 'yes'));
 }
예제 #4
0
 /**
  *	Create mail object.
  *
  *	@return		RM_MailSend_Mail
  */
 public function createMail()
 {
     return $this->_mailStorage->createObject(array('cdate' => M('Tools')->date()->dbDateTime(), 'body_type' => 'text/plain'));
 }
예제 #5
0
 /**
  * Enter description here...
  *
  * @param array $data
  * @return RM_News_Object
  */
 public function createNews($data)
 {
     return $this->_news->createObject($data);
 }
예제 #6
0
파일: Mail.class.php 프로젝트: evilgeny/bob
 /**
  *	Create attachment connected with current mail.
  *
  *	@return		RM_MailSend_Attachment
  */
 public function createAttachment()
 {
     return $this->_attachStorage->createObject(array("mail_id" => $this->id()));
 }