Exemplo n.º 1
0
 /**
  * Extracts relationship inclusions from an array of query params.
  *
  * @param   array   $params
  * @return  self
  */
 private function extractInclusions(array $params)
 {
     if (false === $this->issetNotEmpty(self::PARAM_INCLUSIONS, $params)) {
         if (true === $this->config->includeAllByDefault()) {
             $this->inclusions = ['*' => true];
         }
         return $this;
     }
     $inclusions = explode(',', $params[self::PARAM_INCLUSIONS]);
     foreach ($inclusions as $inclusion) {
         if (false !== stristr($inclusion, '.')) {
             throw RestException::invalidParamValue(self::PARAM_INCLUSIONS, sprintf('Inclusion via a relationship path, e.g. "%s" is currently not supported.', $inclusion));
         }
         $this->inclusions[$inclusion] = true;
     }
     return $this;
 }