This topic contains 1 reply, has 2 voices, and was last updated by Mike Kudelya 7 years ago.
- Topic
- 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111//orocrm/vendor/oro/platform/src/Oro/Bundle/EntityConfigBundle/Controller/ServiceController.phpnamespace Oro\Bundle\EntityConfigBundle\Controller;use Doctrine\ORM\QueryBuilder;use Symfony\Bundle\FrameworkBundle\Controller\Controller;use Symfony\Component\HttpFoundation\RedirectResponse;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;use Oro\Bundle\SecurityBundle\Annotation\Acl;use Oro\Bundle\BatchBundle\ORM\Query\QueryCountCalculator;use Oro\Bundle\EntityBundle\Tools\EntityRoutingHelper;use Oro\Bundle\EntityBundle\Provider\EntityFieldProvider;use Oro\Bundle\EntityConfigBundle\Config\ConfigManager;use Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider;use Oro\Bundle\EntityConfigBundle\Provider\PropertyConfigContainer;use Oro\Bundle\EntityConfigBundle\Tools\ConfigHelper;use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;use Oro\Bundle\EntityConfigBundle\Helper\EntityConfigProviderHelper;use Doctrine\ORM\Query\AST\Functions\ConcatFunction;use Oro\Bundle\EntityConfigBundle\Entity\Services;class ServiceController extends Controller{/*** @Route(name="oro_service_index")* @Template*/public function indexAction(){return $this->render('OroEntityConfigBundle:Service:index.html.twig');}/*** @Route("/create", name="oro_service_create")* @Template("InventoryBundle:Vehicle:update.html.twig")* @Acl(* id="oro_service_create",* type="entity",* class="OroEntityConfigBundle:Services",* permission="CREATE"* )*/public function createAction(Request $request){return $this->update(new Services(), $request);}/*** @Route("/update/{id}", name="oro_service_update", requirements={"id":"\d+"}, defaults={"id":0})* @Template()* @Acl(* id="oro_service_update",* type="entity",* class="OroEntityConfigBundle:Services",* permission="EDIT"* )*/public function updateAction(Services $service, Request $request){return $this->update($service, $request);}public function update(Services $service, Request $request){$form = $this->get('form.factory')->create('service_name', $service);$form->handleRequest($request);if ($form->isSubmitted() && $form->isValid()) {$entityManager = $this->getDoctrine()->getManager();$entityManager->persist($service);$entityManager->flush();return $this->get('oro_ui.router')->redirectAfterSave(array('route' => 'oro_service_update','parameters' => array('id' => $service->getId()),),array('route' => 'oro_service_index'),$service);}return array('entity' => $service,'form' => $form->createView(),);}}1234567891011121314151617//orocrm/vendor/oro/platform/src/Oro/Bundle/EntityConfigBundle/Resources/views/Service/index.html.twig{% extends 'OroUIBundle:actions:index.html.twig' %}{% import 'OroUIBundle::macros.html.twig' as UI %}{% set gridName = 'services-grid' %}{% set pageTitle = 'Services' %}{% block navButtons %}{% if resource_granted('oro_service_create') %}{{ UI.addButton({'path': path('oro_service_create'),'entity_label': 'Service'}) }}{% endif %}{% endblock %}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667//vendor/oro/platform/src/Oro/Bundle/EntityConfigBundle/Resources/views/Service/update.html.twig{% extends 'OroUIBundle:actions:update.html.twig' %}{% import 'OroUIBundle::macros.html.twig' as UI %}{% form_theme form with 'OroFormBundle:Form:fields.html.twig' %}{% if form.vars.value.id %}{% set formAction = path('oro_service_update', { 'id': form.vars.value.id }) %}{% else %}{% set formAction = path('oro_service_create') %}{% endif %}{% block navButtons %}{% if form.vars.value.id and resource_granted('DELETE', form.vars.value) %}{{ UI.deleteButton({'dataUrl': path('oro_delete_service', {'id': form.vars.value.id}),'dataRedirect': path('oro_service_index'),'aCss': 'no-hash remove-button','id': 'btn-remove-tag','dataId': form.vars.value.id,'entity_label': 'Service'}) }}{{ UI.buttonSeparator() }}{% endif %}{{ UI.cancelButton(path('oro_service_index')) }}{% set html = UI.saveAndCloseButton() %}{% if resource_granted('oro_service_update') %}{% set html = html ~ UI.saveAndStayButton() %}{% endif %}{{ UI.dropdownSaveButton({ 'html': html }) }}{% endblock navButtons %}{% block pageHeader %}{% if form.vars.value.id %}{% set breadcrumbs = {'entity': form.vars.value,'indexPath': path('oro_service_index'),'indexLabel': 'Service','entityTitle': 'Service Name'} %}{{ parent() }}{% else %}{% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'Service'}) %}{% include 'OroUIBundle::page_title_block.html.twig' with { title: title } %}{% endif %}{% endblock pageHeader %}{% block content_data %}{% set id = 'Service-edit' %}{% set dataBlocks = [{'title': 'General'|trans,'class': 'active','subblocks': [{'title': '','data': [form_row(form.name),]}]}]%}{% set data = {'formErrors': form_errors(form)? form_errors(form) : null,'dataBlocks': dataBlocks,} %}{{ parent() }}{% endblock content_data %}1234567891011121314151617181920212223242526272829//orocrm/vendor/oro/platform/src/Oro/Bundle/EntityConfigBundle/Form/Type/ServiceType.phpnamespace Oro\Bundle\EntityConfigBundle\Form\Type;use Symfony\Component\Form\AbstractType;use Symfony\Component\Form\FormBuilderInterface;use Symfony\Component\OptionsResolver\OptionsResolverInterface;class ServiceType extends AbstractType{public function buildForm(FormBuilderInterface $builder, array $options){$builder->add('name');}public function configureOptions(OptionsResolver $resolver){$resolver->setDefaults(array('data_class' => 'EntityConfigBundle\Entity\Services',));}public function getName(){return 'service_name';}}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182//orocrm/vendor/oro/platform/src/Oro/Bundle/EntityConfigBundle/Resources/config/oro/datagrids.yml# Services config entities gridservices-grid:acl_resource: oro_service_indexoptions:entityHint: entitytoolbarOptions:pageSize:default_per_page: 100source:type: ormquery:select:- srs.id- srs.namefrom:- { table: OroEntityConfigBundle:Services, alias: srs }columns:id:label: idfrontend_type: integername:label: Namefrontend_type: stringsorters:columns:id:data_name: srs.idname:data_name: srs.namefilters:columns:id:type: numberdata_name: srs.idname:type: stringdata_name: srs.nameproperties:id: ~update_link:type: urlroute: oro_service_updateparams: [ id ]delete_link:type: urlroute: oro_delete_serviceparams: [ id ]actions:update:type: navigateacl_resource: oro_service_updatelabel: oro.grid.action.updateicon: editlink: update_linkrowAction: truedelete:type: navigateacl_resource: oro_delete_servicelabel: oro.grid.action.deleteicon: trashlink: delete_linkoptions:entity_pagination: truecontexts:enabled: true1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071/orocrm/vendor/oro/platform/src/Oro/Bundle/EntityConfigBundle/Entity/Services.php<?phpnamespace Oro\Bundle\EntityConfigBundle\Entity;use Doctrine\ORM\Mapping as ORM;/*** @ORM\Entity* @ORM\Table(name="services")*/class Services{/*** @ORM\Id* @ORM\Column(type="integer")* @ORM\GeneratedValue(strategy="AUTO")*/protected $id;/*** @var string** @ORM\Column(name="name",type="string", length=255)*/protected $name;/*** @return int*/public function getId(){return $this->id;}/*** @param int $id* @return Account*/public function setId($id){$this->id = $id;return $this;}/*** @return string*/public function getName(){return $this->name;}/*** @param string $name*/public function setName($name){$this->name = $name;return $this;}}?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.