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); }
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))); }
public static function getId() { return Request::call(Requests::getUserId()); }
public function count() { $call = Request::call(Requests::getEntriesCount($this->module->getModuleName(), $this->prepareWhere())); return $call->result_count; }
public function into($moduleName) { Request::call(Requests::setEntry($moduleName, $this->attributes)); }
public function into($moduleName) { $call = Request::call(Requests::setEntry($moduleName, $this->attributes)); return $call->id; }
/** * @return File * @throws Exception */ public function getFile() { $call = Request::call(Requests::getDocumentRevision($this->document_revision_id)); return File::create($call); }
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; }