public function addComponentAction($id, $zoneTypeId, $componentTypeId, Request $request)
    {
        if (!$template = $this->container->get('synapse.template.loader')->retrieve($id)) {
            throw new NotFoundHttpException(sprintf('No template found under id "%s"', $id));
        }
        if (!$zoneType = $template->getTemplateType()
            ->getZoneTypes()
            ->search(array('id' => $zoneTypeId))
            ->first()
        ) {
            throw new NotFoundHttpException(sprintf(
                'Zone type "%s" is not activated for template "%s". Please check theme configuration.',
                $zoneTypeId,
                $templateType->getId()
            ));
        }
        if (!$componentType = $this->container->get('synapse.component_type.loader')->retrieve($componentTypeId)) {
            throw new NotFoundHttpException(sprintf(
                'No defined component type found under id "%s". Please check theme configuration.',
                $componentTypeId
            ));
        }

        $this->container->get('synapse.zone.domain')->addComponent(
            $template->getZones()->search(array('zoneType' => $zoneType))->first(),
            $componentType
        );

        return new RedirectResponse(
            $request->server->get('HTTP_REFERER')
        );
    }
public function addComponentAction($id, $zoneTypeId, $componentTypeId, Request $request)
    {
        if (!$template = $this->container->get('synapse.template.loader')->retrieve($id)) {
            throw new NotFoundHttpException(sprintf('No template found under id "%s"', $id));
        }
        if (!$zoneType = $template->getTemplateType()
            ->getZoneTypes()
            ->search(array('id' => $zoneTypeId))
            ->first()
        ) {
            throw new NotFoundHttpException(sprintf(
                'Zone type "%s" is not activated for template "%s". Please check theme configuration.',
                $zoneTypeId,
                $templateType->getId()
            ));
        }
        if (!$componentType = $this->container->get('synapse.component_type.loader')->retrieve($componentTypeId)) {
            throw new NotFoundHttpException(sprintf(
                'No defined component type found under id "%s". Please check theme configuration.',
                $componentTypeId
            ));
        }

        $this->container->get('synapse.zone.domain')->addComponent(
            $template->getZones()->search(array('zoneType' => $zoneType))->first(),
            $componentType
        );

        return new RedirectResponse(
            $request->server->get('HTTP_REFERER')
        );
    }
public function addComponentAction ( $ id , $ zoneTypeId , $ componentTypeId , Request $ request ) { if ( ! $ template = $ this -> container -> get ( 'synapse.template.loader' ) -> retrieve ( $ id ) ) { throw new NotFoundHttpException ( sprintf ( 'No template found under id "%s"' , $ id ) ) ; } if ( ! $ zoneType = $ template -> getTemplateType ( ) -> getZoneTypes ( ) -> search ( array ( 'id' => $ zoneTypeId ) ) -> first ( ) ) { throw new NotFoundHttpException ( sprintf ( 'Zone type "%s" is not activated for template "%s". Please check theme configuration.' , $ zoneTypeId , $ templateType -> getId ( ) ) ) ; } if ( ! $ componentType = $ this -> container -> get ( 'synapse.component_type.loader' ) -> retrieve ( $ componentTypeId ) ) { throw new NotFoundHttpException ( sprintf ( 'No defined component type found under id "%s". Please check theme configuration.' , $ componentTypeId ) ) ; } $ this -> container -> get ( 'synapse.zone.domain' ) -> addComponent ( $ template -> getZones ( ) -> search ( array ( 'zoneType' => $ zoneType ) ) -> first ( ) , $ componentType ) ; return new RedirectResponse ( $ request -> server -> get ( 'HTTP_REFERER' ) ) ; }
Adds a component of given type id into given template id and zone type id.

@param int     $id
@param string  $zoneTypeId
@param string  $componentTypeId
@param Request $request

@return Response
Adds a component of given type id into given template id and zone type id .