This topic contains 1 reply, has 1 voice, and was last updated by msalmi.kais 6 years, 1 month ago.
- Topic
I followed this tutorial:
https://oroinc.com/orocrm/doc/2.3/book/crudmy problem is when displaying the detail of the entity (inventory.vehicle_view) i got his error :
- Error: Unexpected content format
- There was an error performing the requested operation. Please try again or contact us for assistance.
prod.log
1request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Class does not exist")." at C:\EasyPHP-Devserver-17\eds-www\oro-platform\vendor\oro\platform\src\Oro\Bundle\UIBundle/Resources/views/actions/view.html.twig line 113 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Class does not exist\"). at C:\\EasyPHP-Devserver-17\\eds-www\\oro-platform\\vendor\\oro\\platform\\src\\Oro\\Bundle\\UIBundle/Resources/views/actions/view.html.twig:113, ReflectionException(code: -1): Class does not exist at C:\\EasyPHP-Devserver-17\\eds-www\\oro-platform\\app\\cache\\prod\\classes.php:6631)"} []VehicleController
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788# src/InventoryBundle/Controller/VehicleController.phpnamespace InventoryBundle\Controller;use Oro\Bundle\SecurityBundle\Annotation\Acl;use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;use Symfony\Bundle\FrameworkBundle\Controller\Controller;use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use InventoryBundle\Entity\Vehicle;use Symfony\Component\HttpFoundation\Request;use Oro\Bundle\SecurityBundle\Annotation\AclAncestor;/*** @Route("/vehicle")*/class VehicleController extends Controller{/*** @Route("/", name="inventory.vehicle_index")* @Template* @Acl(* id="inventory.vehicle_view",* type="entity",* class="InventoryBundle:Vehicle",* permission="VIEW"* )*/public function indexAction(){return array('gridName' => 'vehicles-grid');}/*** @Route("/create", name="inventory.vehicle_create")* @Template("InventoryBundle:Vehicle:update.html.twig")* @Acl(* id="inventory.vehicle_create",* type="entity",* class="InventoryBundle:Vehicle",* permission="CREATE"* )*/public function createAction(Request $request){return $this->update(new Vehicle(), $request);}/*** @Route("/update/{id}", name="inventory.vehicle_update", requirements={"id":"\d+"}, defaults={"id":0})* @Template()* @Acl(* id="inventory.vehicle_update",* type="entity",* class="InventoryBundle:Vehicle",* permission="EDIT"* )*/public function updateAction(Vehicle $vehicle, Request $request){return $this->update($vehicle, $request);}private function update(Vehicle $vehicle, Request $request){$form = $this->get('form.factory')->create('inventory_vehicle', $vehicle);$form->handleRequest($request);if ($form->isSubmitted() && $form->isValid()) {$entityManager = $this->getDoctrine()->getManager();$entityManager->persist($vehicle);$entityManager->flush();return $this->get('oro_ui.router')->redirectAfterSave(array('route' => 'inventory.vehicle_update','parameters' => array('id' => $vehicle->getId()),),array('route' => 'inventory.vehicle_index'),$vehicle);}return array('entity' => $vehicle,'form' => $form->createView(),);}/*** @Route("/{id}", name="inventory.vehicle_view", requirements={"id"="\d+"})* @Template* @AclAncestor("inventory.vehicle_view")*/public function viewAction(Vehicle $vehicle){return array('vehicle' => $vehicle);}}Template
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061{# src/InventoryBundle/Resources/views/Vehicle/view.html.twig #}{% extends 'OroUIBundle:actions:view.html.twig' %}{% import 'OroUIBundle::macros.html.twig' as UI %}{% block navButtons %}{% if resource_granted('EDIT', vehicle) %}{{ UI.editButton({'path' : path('inventory.vehicle_update', { id: vehicle.id }),'entity_label': 'Vehicle'|trans}) }}{% endif %}{% if resource_granted('DELETE', vehicle) %}{{ UI.deleteButton({'dataUrl': path('inventory_api_delete_vehicle', {'id': vehicle.id}),'dataRedirect': path('inventory.vehicle_index'),'aCss': 'no-hash remove-button','id': 'btn-remove-vehicle','dataId': vehicle.id,'entity_label': 'Vehicle'|trans,}) }}{% endif %}{% endblock navButtons %}{% block pageHeader %}{% set breadcrumbs = {'entity': vehicle,'indexPath': path('inventory.vehicle_index'),'indexLabel': 'Vehicles'|trans,'entityTitle': vehicle.model} %}{{ parent() }}{% endblock pageHeader %}{% block content_data %}{% set data %}<div class="widget-content"><div class="row-fluid form-horizontal"><div class="responsive-block">{{ UI.renderProperty('Model'|trans, vehicle.model) }}{{ UI.renderProperty('Seats'|trans, vehicle.seats) }}{{ UI.renderProperty('Bought at'|trans, vehicle.boughtAt|date) }}{{ UI.renderProperty('Lease until'|trans, vehicle.leaseUntil|date) }}</div></div></div>{% endset %}{% set dataBlocks = [{'title': 'Data'|trans,'class': 'active','subblocks': [{ 'data' : [data] }]}] %}{% set id = 'vehicleView' %}{% set data = { 'dataBlocks': dataBlocks } %}{{ parent() }}{% endblock content_data %}datagrids.yml
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889datagrids:vehicles-grid:source:acl_resource: inventory.vehicle_viewtype: ormquery:select:- v.id- v.model- v.seats- v.boughtAt- v.leaseUntilfrom:- { table: InventoryBundle:Vehicle, alias: v }columns:model:label: Modelseats:label: SeatsboughtAt:label: Bought atfrontend_type: dateleaseUntil:label: Lease untilfrontend_type: dateproperties:id: ~update_link:type: urlroute: inventory.vehicle_updateparams:- idview_link:type: urlroute: inventory.vehicle_viewparams:- iddelete_link:type: urlroute: inventory_api_delete_vehicleparams:- idsorters:columns:model:data_name: v.modelseats:data_name: v.seatsboughtAt:data_name: v.boughtAtleaseUntil:data_name: v.leaseUntildefault:model: ASCfilters:columns:model:type: stringdata_name: v.modelseats:type: numberdata_name: v.seatsboughtAt:type: datedata_name: v.boughtAtleaseUntil:type: datedata_name: v.leaseUntilactions:view:type: navigatelabel: Viewlink: view_linkicon: eyeacl_resource: inventory.vehicle_viewrowAction: trueupdate:type: navigatelabel: Updatelink: update_linkicon: editacl_resource: inventory.vehicle_updatedelete:type: deletelabel: Deletelink: delete_linkicon: trashacl_resource: inventory.vehicle_delete
The forum ‘OroPlatform’ is closed to new topics and replies.