예제 #1
0
 public static function findById($id)
 {
     $call = Request::call(Requests::getDocumentRevision($id));
     if (isset($call->number)) {
         throw new Exception($call->description);
     }
     return self::create($call);
 }
 public function fetchRelation(array $fields = array())
 {
     $requestAction = Requests::getRelationships($this->module->getModuleName(), $this->module->id, $this->relation->getDbName(), $this->relation->getModuleName(), $fields);
     $results = Request::call($requestAction);
     if ($this->relation->isCollection()) {
         return Converter::toModules($results, $this->relationModule);
     }
     return Converter::toModule($results->entry_list[0], $this->relationModule);
 }
예제 #3
0
 public static function connect($url, $login, $password)
 {
     self::$url = $url;
     $result = Request::call(Requests::login($login, $password));
     if (isset($result->number) && $result->number == 10) {
         throw new LoginException($result->name);
     }
     self::$sessionId = $result->id;
     return true;
 }
 public static function forModule($moduleName)
 {
     return new self(Request::call(Requests::getModuleFields($moduleName)));
 }
예제 #5
0
 public static function getId()
 {
     return Request::call(Requests::getUserId());
 }
예제 #6
0
 public function count()
 {
     $call = Request::call(Requests::getEntriesCount($this->module->getModuleName(), $this->prepareWhere()));
     return $call->result_count;
 }
예제 #7
0
 public function into($moduleName)
 {
     Request::call(Requests::setEntry($moduleName, $this->attributes));
 }
예제 #8
0
 public function into($moduleName)
 {
     $call = Request::call(Requests::setEntry($moduleName, $this->attributes));
     return $call->id;
 }
예제 #9
0
 /**
  * @return File
  * @throws Exception
  */
 public function getFile()
 {
     $call = Request::call(Requests::getDocumentRevision($this->document_revision_id));
     return File::create($call);
 }
예제 #10
0
 public function relatedWith(Module $module)
 {
     $result = Request::call(Requests::setRelationship($this->getModuleName(), $this->id, $module->getModuleDbName(), $module->id));
     if ($result->failed) {
         throw new Exception("Creating relationship failed");
     }
     return $result->created == 1;
 }