eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\EzRest::createRequestObject PHP Method

createRequestObject() protected method

Create an object of the specified type.
protected createRequestObject ( string $objectType )
$objectType string the name of the object to be created
    protected function createRequestObject($objectType)
    {
        $repository = $this->getRepository();
        switch ($objectType) {
            case 'SessionInput':
                $this->requestObject = new SessionInput();
                break;
            case 'ContentTypeGroupCreateStruct':
                $this->requestObject = $repository->getContentTypeService()->newContentTypeGroupCreateStruct('identifier');
                break;
            case 'ContentTypeGroupUpdateStruct':
                $this->requestObject = $repository->getContentTypeService()->newContentTypeGroupUpdateStruct();
                break;
            case 'ViewInput':
                $this->requestObject = new ViewInput();
                break;
            default:
                throw new InvalidArgumentException($objectType, 'type is not defined yet');
        }
    }