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); }
/** * @param $row * @param Module $module * @return Module */ public static function toModule($row, Module $module) { $attributes = array(); foreach ($row->name_value_list as $data) { $name = $data->name; $value = $data->value; $attributes[$name] = $value; } return $module->newInstance($attributes); }
public function delete() { $attributes = Arrays::map($this->whereClauses, Functions::extract()->getParams()); $queryInsert = new QueryInsert(Arrays::firstOrNull($attributes)); $id = $queryInsert->into($this->module->getModuleName()); return !is_null($id); }
public function __construct($attributes = array()) { parent::__construct(array('attributes' => $attributes, 'hasMany' => array('accounts' => HasMany::module('Account'), 'contacts' => HasMany::module('Contact'), 'documents' => HasMany::module('Document')))); }
public function __construct($attributes = array()) { parent::__construct(array('attributes' => $attributes)); }
public function __construct($attributes = array()) { parent::__construct(array('attributes' => $attributes, 'belongsTo' => array('account' => BelongsTo::module('Account'), 'quote' => BelongsTo::module('AOS_Quotes')))); }
public function __construct($attributes = array()) { parent::__construct(array('attributes' => $attributes, 'hasMany' => array('contacts' => HasMany::module('Contact'), 'leads' => HasMany::module('Lead'), 'opportunities' => HasMany::module('Opportunity'), 'documents' => HasMany::module('Document'), 'bugs' => HasMany::module('Bug')))); }
public function __construct($attributes = array()) { parent::__construct(array('attributes' => $attributes, 'belongsTo' => array('account' => BelongsTo::module('Account')), 'hasMany' => array('bugs' => HasMany::module('Bug')))); }
public function where($params = array()) { $this->query->where(new WhereClause($this->module->getModuleDbName(), $params)); return $this; }
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; }