Skip to content

Latest commit

 

History

History
111 lines (98 loc) · 2.81 KB

how to start.md

File metadata and controls

111 lines (98 loc) · 2.81 KB

How to start

  1. Generate map of your Entities
php app/console flexix:class-mapper:update-config-file
  1. Add mapper.yml to your app/cofnig.yml file
- { resource: mapper.yml }
  1. Create new App in application section on mapper.yml file

3.1. You should see something like this:

flexix_mapper:
    applications: {  }
    entities:
        flexix_sample_entities:
            discount:
                alias: discount
                entity_class: Flexix\SampleEntitiesBundle\Entity\Discount
            measure_unit:
                alias: measure-unit
                entity_class: Flexix\SampleEntitiesBundle\Entity\MeasureUnit
           #...
            

3.2. Add your routes name to mapper.yml

    applications:
        admin:
            bundles:
                - flexix_sample_entities
            path: sample_sufix_of_your_application

3.3 Add mapper.yml to config.yml

imports:
   #...
   - { resource: mapper.yml }
  1. Configure fos_rest bundle:
fos_rest: 
    view:
        formats:
            json: true
            xml: true
        templating_formats:
            html: true
        force_redirects:
            html: true
        failed_validation: HTTP_BAD_REQUEST
        default_engine: twig
    access_denied_listener:
        json: true    
    format_listener:
            rules:
                - { path: '^/', priorities: [ 'html', 'json', 'xml' ], prefer_extension: false }  

  1. Create configuration for your application in service.yml file of your Symfony bundle
 parameters:    
    some_controller.config: 
        actions: 
        #for 'new' action
            new:
               allowed: true
               templates:
                    widget: 'some_template.html.twig'
               services:#@todo
                    create:
                        name: 'some.service.name'
                        method: someMethod
               form: 
                   action: new 
                   form_type: 'Some\FormTypeClass'
               redirection: 
                    route_name: filter #route name
     
  1. Add configuration service
services:
        some_service_name:
            class: Flexix\ConfigurationBundle\Util\Configuration
            arguments: [%some_controller.config%]
            tags:
                - { name: flexix_prototype_controller.controller_configuration, applicationPath: 'sample_sufix_of_your_application', entityAlias: 'some-entity' }       

  1. Add routing to app/routing.yml
flexix_prototype_controller:
    resource: "@FlexixPrototypeControllerBundle/Resources/config/routing.yml"
    prefix:   /
  1. Yes, it's done, check your browswer!

Check

   your_project/app_dev.php/adress/of/your/app/-/some-entity/new/

You should see AccessDenied Exception. Its Great, everything works fine, you are on right way!