示例#1
0
 /**
  * Relation constructor.
  * @param Model $source
  * @param $attribute
  */
 public function __construct(Model $source, $attribute)
 {
     list($this->model, $this->type) = $source->getRelations()[$attribute];
     if ($this->isRel()) {
         $this->classPath = 'Afosto\\ApiClient\\Models\\' . Inflector::pluralize($this->_getModelForRel()) . '\\' . $this->model;
     } else {
         if ($this->isReference()) {
             $this->classPath = 'Afosto\\ApiClient\\Models\\' . Inflector::pluralize($this->_getModelForReference()) . '\\' . $this->_getModelForReference();
         } else {
             $this->classPath = $source->getNameSpace() . '\\' . $this->model;
         }
     }
 }
示例#2
0
 /**
  * Returns the totalCount
  * @return integer
  */
 public function getTotalCount()
 {
     if (is_null($this->_totalCount)) {
         $count = $this->_owner->findCount();
         $this->_totalCount = $count->total;
     }
     return $this->_totalCount;
 }
示例#3
0
 /**
  * Map model data
  * @return array
  */
 protected function getMapping()
 {
     return array_merge([], parent::getMapping());
 }
示例#4
0
文件: Api.php 项目: afosto/api-client
 /**
  * Update the pagination data accordingly to the results of the last request
  */
 private function _updatePagination()
 {
     if (!empty($this->_response->getHeader(ApiHelper::HEADER_TOTAL_COUNT))) {
         $this->_owner->getPagination()->update(current($this->_response->getHeader(ApiHelper::HEADER_TOTAL_COUNT)));
     }
 }