2017 © Pedro Peláez
 

symfony-bundle base-bundle

Symfony VinceTBaseBundle

image

vincet/base-bundle

Symfony VinceTBaseBundle

  • Tuesday, October 25, 2016
  • by vincenttouzet
  • Repository
  • 1 Watchers
  • 1 Stars
  • 933 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

BaseBundle

This bundle define base class to improve your development., (*1)

It requires SonataAdminBundle and SonataDoctrineORMAdminBundle, (*2)

Installation

Use composer to install, (*3)

composer require vincet/base-bundle

For symfony <2.5 use the 2.2 version, (*4)

composer require vincet/base-bundle=2.2

Entity Management

This bundle defines a BaseManager class that is compatible with SonataAdmin ModelManager., (*5)

Juste define a new class for your entity :, (*6)

namespace Acme\DemoBundle\Manager;

use VinceT\BaseBundle\Manager\BaseManager;

class PostManager extends BaseManager
{
}

Define the manager as a service in your services.yml :, (*7)

parameters:
    post_manager.class: Acme\DemoBundle\Manager\PostManager

services:
    post_manager:
        class: %post_manager.class%
        arguments: [@service_container]

you can now acces this manager from any controller :, (*8)

[...]
$postManager = $this->container->get('post_manager');
[...]
$post = new Acme\DemoBundle\Entity\Post();
[...]
$postManager->create($post);
[...]
$postManager->update($post);
[...]
$postManager->delete($post);
[...]

To use this manager with SonataAdmin, add a call to setModelManager in your services.yml file, (*9)

services:
    acme.demo.admin.post:
      class: Acme\DemoBundle\Admin\PostAdmin
      tags:
        - { name: sonata.admin, manager_type: orm, group: Blog, label: Post }
      arguments: [null, Acme\DemoBundle\Entity\Post, AcmeDemoBundle:PostAdmin]
      calls:
        - [ setModelManager, [ @page_manager ] ]
        - [ setTranslationDomain, [ AcmeDemoBundle ] ]

Your front and Admin application will now use the same entity manager., (*10)

Admin Controller

This bundle also define a BaseAdminController that catch exception throwed during an admin action. It is very easy to use :, (*11)

Define your admin controller :, (*12)

namespace Acmd\DemoBundle\Controller;

use VinceT\BaseBundle\Controller\BaseAdminController;

class PostAdminController extends BaseAdminController
{
}

Don't forget to use this controller in your admin service (the third argument)., (*13)

services:
    acme.demo.admin.post:
      class: Acme\DemoBundle\Admin\PostAdmin
      tags:
        - { name: sonata.admin, manager_type: orm, group: Blog, label: Post }
      arguments: [null, Acme\DemoBundle\Entity\Post, AcmeDemoBundle:PostAdmin]

Commands

To make your development faster a command can generate the following classes for an entity, bundle or namespace : * Admin/EntityAdmin * Controller/Admin/EntityAdminController * Manager/EntityManager, (*14)

and create/update the following files : * Resources/config/services.yml * Resources/translations/YourBundle.en.yml * Resources/translations/YourBundle.fr.yml, (*15)

To use it :, (*16)

php app/console vincet:generate MyBundle:Post

Another command generate a frontend CRUD controller. It's based on the \Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCrudCommand, (*17)

To use it :, (*18)

php app/console vincet:generate:crud

The Versions

10/04 2016
24/07 2015

4.0.0

4.0.0.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

19/07 2015

3.0.5

3.0.5.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

19/07 2015

3.0.4

3.0.4.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

19/06 2015

3.0.3

3.0.3.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

16/03 2015

3.0.2

3.0.2.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

08/03 2015

3.0.1

3.0.1.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

06/01 2015

3.0.0

3.0.0.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

15/09 2013

2.2.x-dev

2.2.9999999.9999999-dev

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

15/09 2013

2.2.0

2.2.0.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

02/07 2013

2.1.x-dev

2.1.9999999.9999999-dev

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet

02/07 2013

2.1.0

2.1.0.0

Symfony VinceTBaseBundle

  Sources   Download

MIT

The Requires

 

by Vincent Touzet