__construct() public method

public __construct ( Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $factory )
$factory Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
Esempio n. 1
0
 /**
  * @param FactoryInterface      $factory
  * @param JsonSchemesInterface  $jsonSchemes
  * @param ModelSchemesInterface $modelSchemes
  */
 public function __construct(FactoryInterface $factory, JsonSchemesInterface $jsonSchemes, ModelSchemesInterface $modelSchemes)
 {
     $this->resourceType = static::TYPE;
     parent::__construct($factory);
     $this->jsonSchemes = $jsonSchemes;
     $this->modelSchemes = $modelSchemes;
 }
Esempio n. 2
0
 /**
  * @param SchemaFactoryInterface $factory
  * @param ContainerInterface     $container
  * @param string                 $classType
  * @param Closure                $identityClosure function($resource) : string
  */
 public function __construct(SchemaFactoryInterface $factory, ContainerInterface $container, $classType, Closure $identityClosure)
 {
     $schemaForRealType = $container->getSchemaByType($classType);
     $this->resourceType = $schemaForRealType->getResourceType();
     $this->selfSubUrl = $schemaForRealType->getSelfSubUrl();
     parent::__construct($factory, $container);
     $this->identityClosure = $identityClosure;
 }
Esempio n. 3
0
 /**
  * Class constructor
  *
  * @param Neomerx\JsonApi\Contracts\Schema\ContainerInterface $factory ContainerInterface
  * @param Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $container SchemaFactoryInterface
  * @param Cake\View\View $view Instance of the cake view we are rendering this in
  * @param string $entityName Name of the entity this schema is for
  */
 public function __construct(SchemaFactoryInterface $factory, ContainerInterface $container, View $view, $entityName)
 {
     $this->_view = $view;
     if (!$this->resourceType) {
         $this->resourceType = strtolower(Inflector::pluralize($entityName));
     }
     parent::__construct($factory, $container);
 }
Esempio n. 4
0
 /**
  * @param SchemaFactoryInterface $factory
  * @param ContainerInterface     $container
  * @param string                 $resourceClassname     identifies ResourceInterface object to handle schema for
  */
 public function __construct(SchemaFactoryInterface $factory, ContainerInterface $container, $resourceClassname = null)
 {
     $this->resourceClassname = $resourceClassname;
     // temporary resource instance, just for the resource type & sub url
     // the real resource will be set later, using setResource() calls
     $this->resourceInstance = new $resourceClassname();
     $this->checkResourceClass($this->resourceInstance);
     $this->resourceType = $this->resourceInstance->getResourceType();
     $this->selfSubUrl = $this->resourceInstance->getResourceSubUrl();
     parent::__construct($factory, $container);
 }