예제 #1
0
 /**
  * Set path to current frame.
  */
 private function setCurrentPath()
 {
     if ($this->previous === null || $this->previous->getPath() === null) {
         $this->path = $this->relationship->getName();
     } else {
         $this->path = $this->previous->getPath() . '.' . $this->relationship->getName();
     }
 }
예제 #2
0
 /**
  * Set path to current frame.
  */
 private function setCurrentPath()
 {
     if ($this->previous === null || $this->previous->getPath() === null) {
         $this->path = $this->relationship->getName();
     } else {
         $this->path = $this->previous->getPath() . DocumentInterface::PATH_SEPARATOR . $this->relationship->getName();
     }
 }
예제 #3
0
파일: Parser.php 프로젝트: neomerx/json-api
 /**
  * @param mixed                       $resource
  * @param StackFrameReadOnlyInterface $frame
  *
  * @return SchemaProviderInterface
  */
 private function getSchema($resource, StackFrameReadOnlyInterface $frame)
 {
     try {
         $schema = $this->container->getSchema($resource);
     } catch (InvalidArgumentException $exception) {
         $message = T::t('Schema is not registered for a resource at path \'%s\'.', [$frame->getPath()]);
         throw new InvalidArgumentException($message, 0, $exception);
     }
     return $schema;
 }
예제 #4
0
 /**
  * If relationship from 'parent' to 'current' resource passes field set filter.
  *
  * @param Frame $current
  * @param Frame $previous
  *
  * @return bool
  */
 private function isRelationshipInFieldSet(Frame $current, Frame $previous)
 {
     $parentType = $previous->getResource()->getType();
     $parameters = $this->parameterAnalyzer->getParameters();
     if (($fieldSet = $parameters->getFieldSet($parentType)) === null) {
         return true;
     }
     return in_array($current->getRelationship()->getName(), $fieldSet, true) === true;
 }