diff --git a/cookbook/doctrine/event_listeners_subscribers.rst b/cookbook/doctrine/event_listeners_subscribers.rst index fb1274a38a7..f9fc092bd49 100644 --- a/cookbook/doctrine/event_listeners_subscribers.rst +++ b/cookbook/doctrine/event_listeners_subscribers.rst @@ -42,15 +42,15 @@ managers that use this connection. services: my.listener: - class: Acme\SearchBundle\EventListener\SearchIndexer + class: AppBundle\EventListener\SearchIndexer tags: - { name: doctrine.event_listener, event: postPersist } my.listener2: - class: Acme\SearchBundle\EventListener\SearchIndexer2 + class: AppBundle\EventListener\SearchIndexer2 tags: - { name: doctrine.event_listener, event: postPersist, connection: default } my.subscriber: - class: Acme\SearchBundle\EventListener\SearchIndexerSubscriber + class: AppBundle\EventListener\SearchIndexerSubscriber tags: - { name: doctrine.event_subscriber, connection: default } @@ -67,13 +67,13 @@ managers that use this connection. - + - + - + @@ -98,21 +98,21 @@ managers that use this connection. $container ->setDefinition( 'my.listener', - new Definition('Acme\SearchBundle\EventListener\SearchIndexer') + new Definition('AppBundle\EventListener\SearchIndexer') ) ->addTag('doctrine.event_listener', array('event' => 'postPersist')) ; $container ->setDefinition( 'my.listener2', - new Definition('Acme\SearchBundle\EventListener\SearchIndexer2') + new Definition('AppBundle\EventListener\SearchIndexer2') ) ->addTag('doctrine.event_listener', array('event' => 'postPersist', 'connection' => 'default')) ; $container ->setDefinition( 'my.subscriber', - new Definition('Acme\SearchBundle\EventListener\SearchIndexerSubscriber') + new Definition('AppBundle\EventListener\SearchIndexerSubscriber') ) ->addTag('doctrine.event_subscriber', array('connection' => 'default')) ; @@ -124,11 +124,11 @@ In the previous example, a service ``my.listener`` was configured as a Doctrine listener on the event ``postPersist``. The class behind that service must have a ``postPersist`` method, which will be called when the event is dispatched:: - // src/Acme/SearchBundle/EventListener/SearchIndexer.php - namespace Acme\SearchBundle\EventListener; + // src/AppBundle/EventListener/SearchIndexer.php + namespace AppBundle\EventListener; use Doctrine\ORM\Event\LifecycleEventArgs; - use Acme\StoreBundle\Entity\Product; + use AppBundle\Entity\Product; class SearchIndexer { @@ -160,13 +160,13 @@ Creating the Subscriber Class A Doctrine event subscriber must implement the ``Doctrine\Common\EventSubscriber`` interface and have an event method for each event it subscribes to:: - // src/Acme/SearchBundle/EventListener/SearchIndexerSubscriber.php - namespace Acme\SearchBundle\EventListener; + // src/AppBundle/EventListener/SearchIndexerSubscriber.php + namespace AppBundle\EventListener; use Doctrine\Common\EventSubscriber; use Doctrine\ORM\Event\LifecycleEventArgs; // for Doctrine 2.4: Doctrine\Common\Persistence\Event\LifecycleEventArgs; - use Acme\StoreBundle\Entity\Product; + use AppBundle\Entity\Product; class SearchIndexerSubscriber implements EventSubscriber { diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index 96269168bb0..4e086ed699e 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -207,7 +207,7 @@ rules:: .. code-block:: php // src/AppBundle/Entity/Document.php - namespace Acme\DemoBundle\Entity; + namespace AppBundle\Entity; // ... use Symfony\Component\Validator\Mapping\ClassMetadata; diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 4cfbd1bc88a..418c4f1a4e6 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -15,8 +15,8 @@ The simple User Model You have a simple ``User`` entity mapped to the database:: - // src/Acme/AccountBundle/Entity/User.php - namespace Acme\AccountBundle\Entity; + // src/AppBundle/Entity/User.php + namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; @@ -106,8 +106,8 @@ Create a Form for the Model Next, create the form for the ``User`` model:: - // src/Acme/AccountBundle/Form/Type/UserType.php - namespace Acme\AccountBundle\Form\Type; + // src/AppBundle/Form/Type/UserType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -128,7 +128,7 @@ Next, create the form for the ``User`` model:: public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Acme\AccountBundle\Entity\User' + 'data_class' => 'AppBundle\Entity\User' )); } @@ -156,17 +156,17 @@ be stored in the database. Start by creating a simple class which represents the "registration":: - // src/Acme/AccountBundle/Form/Model/Registration.php - namespace Acme\AccountBundle\Form\Model; + // src/AppBundle/Form/Model/Registration.php + namespace AppBundle\Form\Model; use Symfony\Component\Validator\Constraints as Assert; - use Acme\AccountBundle\Entity\User; + use AppBundle\Entity\User; class Registration { /** - * @Assert\Type(type="Acme\AccountBundle\Entity\User") + * @Assert\Type(type="AppBundle\Entity\User") * @Assert\Valid() */ protected $user; @@ -200,8 +200,8 @@ Start by creating a simple class which represents the "registration":: Next, create the form for this ``Registration`` model:: - // src/Acme/AccountBundle/Form/Type/RegistrationType.php - namespace Acme\AccountBundle\Form\Type; + // src/AppBundle/Form/Type/RegistrationType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -236,13 +236,13 @@ Handling the Form Submission Next, you need a controller to handle the form. Start by creating a simple controller for displaying the registration form:: - // src/Acme/AccountBundle/Controller/AccountController.php - namespace Acme\AccountBundle\Controller; + // src/AppBundle/Controller/AccountController.php + namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; - use Acme\AccountBundle\Form\Type\RegistrationType; - use Acme\AccountBundle\Form\Model\Registration; + use AppBundle\Form\Type\RegistrationType; + use AppBundle\Form\Model\Registration; class AccountController extends Controller { @@ -254,7 +254,7 @@ controller for displaying the registration form:: )); return $this->render( - 'AcmeAccountBundle:Account:register.html.twig', + 'AppBundle:Account:register.html.twig', array('form' => $form->createView()) ); } @@ -264,7 +264,7 @@ And its template: .. code-block:: html+jinja - {# src/Acme/AccountBundle/Resources/views/Account/register.html.twig #} + {# src/AppBundle/Resources/views/Account/register.html.twig #} {{ form(form) }} Next, create the controller which handles the form submission. This performs @@ -291,7 +291,7 @@ the validation and saves the data into the database:: } return $this->render( - 'AcmeAccountBundle:Account:register.html.twig', + 'AppBundle:Account:register.html.twig', array('form' => $form->createView()) ); } @@ -307,44 +307,44 @@ Next, update your routes. If you're placing your routes inside your bundle .. code-block:: yaml - # src/Acme/AccountBundle/Resources/config/routing.yml + # src/AppBundle/Resources/config/routing.yml account_register: path: /register - defaults: { _controller: AcmeAccountBundle:Account:register } + defaults: { _controller: AppBundle:Account:register } account_create: path: /register/create - defaults: { _controller: AcmeAccountBundle:Account:create } + defaults: { _controller: AppBundle:Account:create } .. code-block:: xml - + - AcmeAccountBundle:Account:register + AppBundle:Account:register - AcmeAccountBundle:Account:create + AppBundle:Account:create .. code-block:: php - // src/Acme/AccountBundle/Resources/config/routing.php + // src/AppBundle/Resources/config/routing.php use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Route; $collection = new RouteCollection(); $collection->add('account_register', new Route('/register', array( - '_controller' => 'AcmeAccountBundle:Account:register', + '_controller' => 'AppBundle:Account:register', ))); $collection->add('account_create', new Route('/register/create', array( - '_controller' => 'AcmeAccountBundle:Account:create', + '_controller' => 'AppBundle:Account:create', ))); return $collection; diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index c13d2c44903..364b045e587 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -303,7 +303,7 @@ the ``genders`` parameter value as the first argument to its to-be-created # src/AppBundle/Resources/config/services.yml services: - acme_demo.form.type.gender: + app.form.type.gender: class: AppBundle\Form\Type\GenderType arguments: - "%genders%" @@ -313,7 +313,7 @@ the ``genders`` parameter value as the first argument to its to-be-created .. code-block:: xml - + %genders% @@ -324,7 +324,7 @@ the ``genders`` parameter value as the first argument to its to-be-created use Symfony\Component\DependencyInjection\Definition; $container - ->setDefinition('acme_demo.form.type.gender', new Definition( + ->setDefinition('app.form.type.gender', new Definition( 'AppBundle\Form\Type\GenderType', array('%genders%') )) diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index 1178b180c39..40e61306609 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -48,8 +48,8 @@ When creating a form type extension, you can either implement the or extend the :class:`Symfony\\Component\\Form\\AbstractTypeExtension` class. In most cases, it's easier to extend the abstract class:: - // src/Acme/DemoBundle/Form/Extension/ImageTypeExtension.php - namespace Acme\DemoBundle\Form\Extension; + // src/AppBundle/Form/Extension/ImageTypeExtension.php + namespace AppBundle\Form\Extension; use Symfony\Component\Form\AbstractTypeExtension; @@ -103,15 +103,15 @@ tag: .. code-block:: yaml services: - acme_demo_bundle.image_type_extension: - class: Acme\DemoBundle\Form\Extension\ImageTypeExtension + app.image_type_extension: + class: AppBundle\Form\Extension\ImageTypeExtension tags: - { name: form.type_extension, alias: file } .. code-block:: xml - @@ -120,8 +120,8 @@ tag: $container ->register( - 'acme_demo_bundle.image_type_extension', - 'Acme\DemoBundle\Form\Extension\ImageTypeExtension' + 'app.image_type_extension', + 'AppBundle\Form\Extension\ImageTypeExtension' ) ->addTag('form.type_extension', array('alias' => 'file')); @@ -140,8 +140,8 @@ you have a Media model with a file property (corresponding to the file field in the form) and a path property (corresponding to the image path in the database):: - // src/Acme/DemoBundle/Entity/Media.php - namespace Acme\DemoBundle\Entity; + // src/AppBundle/Entity/Media.php + namespace AppBundle\Entity; use Symfony\Component\Validator\Constraints as Assert; @@ -188,8 +188,8 @@ you will be able to specify a new option: ``image_path``. This option will tell the file field how to get the actual image URL in order to display it in the view:: - // src/Acme/DemoBundle/Form/Extension/ImageTypeExtension.php - namespace Acme\DemoBundle\Form\Extension; + // src/AppBundle/Form/Extension/ImageTypeExtension.php + namespace AppBundle\Form\Extension; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\FormView; @@ -260,7 +260,7 @@ Specifically, you need to override the ``file_widget`` block: .. code-block:: html+jinja - {# src/Acme/DemoBundle/Resources/views/Form/fields.html.twig #} + {# src/AppBundle/Resources/views/Form/fields.html.twig #} {% extends 'form_div_layout.html.twig' %} {% block file_widget %} @@ -276,7 +276,7 @@ Specifically, you need to override the ``file_widget`` block: .. code-block:: html+php - + widget($form) ?> @@ -296,8 +296,8 @@ From now on, when adding a field of type ``file`` in your form, you can specify an ``image_path`` option that will be used to display an image next to the file field. For example:: - // src/Acme/DemoBundle/Form/Type/MediaType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/MediaType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index 946174d10b4..a734ddfa9c5 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -161,17 +161,17 @@ to and from the issue number and the ``Issue`` object:: namespace AppBundle\Form\DataTransformer; use AppBundle\Entity\Issue; - use Doctrine\Common\Persistence\EntityManager; + use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; class IssueToNumberTransformer implements DataTransformerInterface { - private $entityManager; + private $manager; - public function __construct(EntityManager $entityManager) + public function __construct(ObjectManager $manager) { - $this->entityManager = $entityManager; + $this->manager = $manager; } /** @@ -203,7 +203,7 @@ to and from the issue number and the ``Issue`` object:: return; } - $issue = $this->entityManager + $issue = $this->manager ->getRepository('AppBundle:Issue') // query for the issue with this id ->find($issueNumber) @@ -253,16 +253,16 @@ to be passed in. Then, you can easily create and add the transformer:: namespace AppBundle\Form\Type; use AppBundle\Form\DataTransformer\IssueToNumberTransformer; - use Doctrine\Common\Persistence\EntityManager; + use Doctrine\Common\Persistence\ObjectManager; // ... class TaskType extends AbstractType { - private $entityManager; + private $manager; - public function __construct(EntityManager $entityManager) + public function __construct(ObjectManager $manager) { - $this->entityManager = $entityManager; + $this->manager = $manager; } public function buildForm(FormBuilderInterface $builder, array $options) @@ -277,7 +277,7 @@ to be passed in. Then, you can easily create and add the transformer:: // ... $builder->get('issue') - ->addModelTransformer(new IssueToNumberTransformer($this->entityManager)); + ->addModelTransformer(new IssueToNumberTransformer($this->manager)); } // ... @@ -286,8 +286,8 @@ to be passed in. Then, you can easily create and add the transformer:: Now, when you create your ``TaskType``, you'll need to pass in the entity manager:: // e.g. in a controller somewhere - $entityManager = $this->getDoctrine()->getManager(); - $form = $this->createForm(new TaskType($entityManager), $task); + $manager = $this->getDoctrine()->getManager(); + $form = $this->createForm(new TaskType($manager), $task); // ... @@ -331,23 +331,23 @@ First, create the custom field type class:: namespace AppBundle\Form; use AppBundle\Form\DataTransformer\IssueToNumberTransformer; - use Doctrine\ORM\EntityManager; + use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class IssueSelectorType extends AbstractType { - private $entityManager; + private $manager; - public function __construct(EntityManager $entityManager) + public function __construct(ObjectManager $manager) { - $this->entityManager = $entityManager; + $this->manager = $manager; } public function buildForm(FormBuilderInterface $builder, array $options) { - $transformer = new IssueToNumberTransformer($this->entityManager); + $transformer = new IssueToNumberTransformer($this->manager); $builder->addModelTransformer($transformer); } diff --git a/cookbook/form/direct_submit.rst b/cookbook/form/direct_submit.rst index 221f7f534d8..108e3504756 100644 --- a/cookbook/form/direct_submit.rst +++ b/cookbook/form/direct_submit.rst @@ -28,7 +28,7 @@ submissions:: return $this->redirect($this->generateUrl('task_success')); } - return $this->render('AcmeTaskBundle:Default:new.html.twig', array( + return $this->render('AppBundle:Default:new.html.twig', array( 'form' => $form->createView(), )); } @@ -70,7 +70,7 @@ method, pass the submitted data directly to } } - return $this->render('AcmeTaskBundle:Default:new.html.twig', array( + return $this->render('AppBundle:Default:new.html.twig', array( 'form' => $form->createView(), )); } @@ -115,7 +115,7 @@ a convenient shortcut to the previous example:: } } - return $this->render('AcmeTaskBundle:Default:new.html.twig', array( + return $this->render('AppBundle:Default:new.html.twig', array( 'form' => $form->createView(), )); } diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index 866a1d1b024..ac4fe276c51 100644 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -23,8 +23,8 @@ that Task, right inside the same form. First, suppose that each ``Task`` belongs to multiple ``Tag`` objects. Start by creating a simple ``Task`` class:: - // src/Acme/TaskBundle/Entity/Task.php - namespace Acme\TaskBundle\Entity; + // src/AppBundle/Entity/Task.php + namespace AppBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; @@ -64,8 +64,8 @@ by creating a simple ``Task`` class:: Now, create a ``Tag`` class. As you saw above, a ``Task`` can have many ``Tag`` objects:: - // src/Acme/TaskBundle/Entity/Tag.php - namespace Acme\TaskBundle\Entity; + // src/AppBundle/Entity/Tag.php + namespace AppBundle\Entity; class Tag { @@ -79,8 +79,8 @@ objects:: Then, create a form class so that a ``Tag`` object can be modified by the user:: - // src/Acme/TaskBundle/Form/Type/TagType.php - namespace Acme\TaskBundle\Form\Type; + // src/AppBundle/Form/Type/TagType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -96,7 +96,7 @@ Then, create a form class so that a ``Tag`` object can be modified by the user:: public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Acme\TaskBundle\Entity\Tag', + 'data_class' => 'AppBundle\Entity\Tag', )); } @@ -113,8 +113,8 @@ form itself, create a form for the ``Task`` class. Notice that you embed a collection of ``TagType`` forms using the :doc:`collection ` field type:: - // src/Acme/TaskBundle/Form/Type/TaskType.php - namespace Acme\TaskBundle\Form\Type; + // src/AppBundle/Form/Type/TaskType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -132,7 +132,7 @@ Notice that you embed a collection of ``TagType`` forms using the public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Acme\TaskBundle\Entity\Task', + 'data_class' => 'AppBundle\Entity\Task', )); } @@ -144,12 +144,12 @@ Notice that you embed a collection of ``TagType`` forms using the In your controller, you'll now initialize a new instance of ``TaskType``:: - // src/Acme/TaskBundle/Controller/TaskController.php - namespace Acme\TaskBundle\Controller; + // src/AppBundle/Controller/TaskController.php + namespace AppBundle\Controller; - use Acme\TaskBundle\Entity\Task; - use Acme\TaskBundle\Entity\Tag; - use Acme\TaskBundle\Form\Type\TaskType; + use AppBundle\Entity\Task; + use AppBundle\Entity\Tag; + use AppBundle\Form\Type\TaskType; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; @@ -177,7 +177,7 @@ In your controller, you'll now initialize a new instance of ``TaskType``:: // ... maybe do some form processing, like saving the Task and Tag objects } - return $this->render('AcmeTaskBundle:Task:new.html.twig', array( + return $this->render('AppBundle:Task:new.html.twig', array( 'form' => $form->createView(), )); } @@ -193,7 +193,7 @@ zero tags when first created). .. code-block:: html+jinja - {# src/Acme/TaskBundle/Resources/views/Task/new.html.twig #} + {# src/AppBundle/Resources/views/Task/new.html.twig #} {# ... #} @@ -214,7 +214,7 @@ zero tags when first created). .. code-block:: html+php - + @@ -275,7 +275,7 @@ type expects to receive exactly two, otherwise an error will be thrown: ``This form should not contain extra fields``. To make this flexible, add the ``allow_add`` option to your collection field:: - // src/Acme/TaskBundle/Form/Type/TaskType.php + // src/AppBundle/Form/Type/TaskType.php // ... use Symfony\Component\Form\FormBuilderInterface; @@ -420,8 +420,8 @@ into new ``Tag`` objects and added to the ``tags`` property of the ``Task`` obje To make handling these new tags easier, add an "adder" and a "remover" method for the tags in the ``Task`` class:: - // src/Acme/TaskBundle/Entity/Task.php - namespace Acme\TaskBundle\Entity; + // src/AppBundle/Entity/Task.php + namespace AppBundle\Entity; // ... class Task @@ -441,7 +441,7 @@ for the tags in the ``Task`` class:: Next, add a ``by_reference`` option to the ``tags`` field and set it to ``false``:: - // src/Acme/TaskBundle/Form/Type/TaskType.php + // src/AppBundle/Form/Type/TaskType.php // ... public function buildForm(FormBuilderInterface $builder, array $options) @@ -475,7 +475,7 @@ you will learn about next!). Doctrine: A new entity was found through the relationship - ``Acme\TaskBundle\Entity\Task#tags`` that was not configured to + ``AppBundle\Entity\Task#tags`` that was not configured to cascade persist operations for entity... To fix this, you may choose to "cascade" the persist operation automatically @@ -486,7 +486,7 @@ you will learn about next!). .. code-block:: php-annotations - // src/Acme/TaskBundle/Entity/Task.php + // src/AppBundle/Entity/Task.php // ... @@ -497,8 +497,8 @@ you will learn about next!). .. code-block:: yaml - # src/Acme/TaskBundle/Resources/config/doctrine/Task.orm.yml - Acme\TaskBundle\Entity\Task: + # src/AppBundle/Resources/config/doctrine/Task.orm.yml + AppBundle\Entity\Task: type: entity # ... oneToMany: @@ -508,13 +508,13 @@ you will learn about next!). .. code-block:: xml - + - + @@ -536,7 +536,7 @@ you will learn about next!). which is called by the form type since ``by_reference`` is set to ``false``:: - // src/Acme/TaskBundle/Entity/Task.php + // src/AppBundle/Entity/Task.php // ... public function addTag(Tag $tag) @@ -548,7 +548,7 @@ you will learn about next!). Inside ``Tag``, just make sure you have an ``addTask`` method:: - // src/Acme/TaskBundle/Entity/Tag.php + // src/AppBundle/Entity/Tag.php // ... public function addTask(Task $task) @@ -571,7 +571,7 @@ The solution is similar to allowing tags to be added. Start by adding the ``allow_delete`` option in the form Type:: - // src/Acme/TaskBundle/Form/Type/TaskType.php + // src/AppBundle/Form/Type/TaskType.php // ... public function buildForm(FormBuilderInterface $builder, array $options) @@ -586,7 +586,7 @@ Start by adding the ``allow_delete`` option in the form Type:: Now, you need to put some code into the ``removeTag`` method of ``Task``:: - // src/Acme/TaskBundle/Entity/Task.php + // src/AppBundle/Entity/Task.php // ... class Task @@ -670,7 +670,7 @@ the relationship between the removed ``Tag`` and ``Task`` object. on the removed tag. This assumes that you have some ``editAction`` which is handling the "update" of your Task:: - // src/Acme/TaskBundle/Controller/TaskController.php + // src/AppBundle/Controller/TaskController.php use Doctrine\Common\Collections\ArrayCollection; @@ -678,7 +678,7 @@ the relationship between the removed ``Tag`` and ``Task`` object. public function editAction($id, Request $request) { $em = $this->getDoctrine()->getManager(); - $task = $em->getRepository('AcmeTaskBundle:Task')->find($id); + $task = $em->getRepository('AppBundle:Task')->find($id); if (!$task) { throw $this->createNotFoundException('No task found for is '.$id); diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 18c693754e8..12b5e372109 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -36,11 +36,11 @@ The Basics The simplest ``TypeTestCase`` implementation looks like the following:: - // src/Acme/TestBundle/Tests/Form/Type/TestedTypeTest.php - namespace Acme\TestBundle\Tests\Form\Type; + // src/AppBundle/Tests/Form/Type/TestedTypeTest.php + namespace AppBundle\Tests\Form\Type; - use Acme\TestBundle\Form\Type\TestedType; - use Acme\TestBundle\Model\TestObject; + use AppBundle\Form\Type\TestedType; + use AppBundle\Model\TestObject; use Symfony\Component\Form\Test\TypeTestCase; class TestedTypeTest extends TypeTestCase @@ -115,20 +115,20 @@ Adding a Type your Form Depends on Your form may depend on other types that are defined as services. It might look like this:: - // src/Acme/TestBundle/Form/Type/TestedType.php + // src/AppBundle/Form/Type/TestedType.php // ... the buildForm method - $builder->add('acme_test_child_type'); + $builder->add('app_test_child_type'); To create your form correctly, you need to make the type available to the form factory in your test. The easiest way is to register it manually before creating the parent form using the ``PreloadedExtension`` class:: - // src/Acme/TestBundle/Tests/Form/Type/TestedTypeTests.php - namespace Acme\TestBundle\Tests\Form\Type; + // src/AppBundle/Tests/Form/Type/TestedTypeTests.php + namespace AppBundle\Tests\Form\Type; - use Acme\TestBundle\Form\Type\TestedType; - use Acme\TestBundle\Model\TestObject; + use AppBundle\Form\Type\TestedType; + use AppBundle\Model\TestObject; use Symfony\Component\Form\Test\TypeTestCase; use Symfony\Component\Form\PreloadedExtension; @@ -167,11 +167,11 @@ The ``TypeTestCase`` loads only the core form extension so an "Invalid option" exception will be raised if you try to use it for testing a class that depends on other extensions. You need add those extensions to the factory object:: - // src/Acme/TestBundle/Tests/Form/Type/TestedTypeTests.php - namespace Acme\TestBundle\Tests\Form\Type; + // src/AppBundle/Tests/Form/Type/TestedTypeTests.php + namespace AppBundle\Tests\Form\Type; - use Acme\TestBundle\Form\Type\TestedType; - use Acme\TestBundle\Model\TestObject; + use AppBundle\Form\Type\TestedType; + use AppBundle\Model\TestObject; use Symfony\Component\Form\Test\TypeTestCase; use Symfony\Component\Form\Forms; use Symfony\Component\Form\FormBuilder; @@ -216,11 +216,11 @@ Testing against different Sets of Data If you are not familiar yet with PHPUnit's `data providers`_, this might be a good opportunity to use them:: - // src/Acme/TestBundle/Tests/Form/Type/TestedTypeTests.php - namespace Acme\TestBundle\Tests\Form\Type; + // src/AppBundle/Tests/Form/Type/TestedTypeTests.php + namespace AppBundle\Tests\Form\Type; - use Acme\TestBundle\Form\Type\TestedType; - use Acme\TestBundle\Model\TestObject; + use AppBundle\Form\Type\TestedType; + use AppBundle\Model\TestObject; use Symfony\Component\Form\Test\TypeTestCase; class TestedTypeTest extends TypeTestCase diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index a91f396ee2a..35be4a1bc32 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -304,7 +304,7 @@ using a processor. .. code-block:: php - namespace Acme\MyBundle; + namespace AppBundle; use Symfony\Component\HttpFoundation\Session\Session; @@ -346,7 +346,7 @@ using a processor. - "[%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%%\n" monolog.processor.session_request: - class: Acme\MyBundle\SessionRequestProcessor + class: AppBundle\SessionRequestProcessor arguments: ["@session"] tags: - { name: monolog.processor, method: processRecord } @@ -379,7 +379,7 @@ using a processor. + class="AppBundle\SessionRequestProcessor"> @@ -410,7 +410,7 @@ using a processor. $container ->register( 'monolog.processor.session_request', - 'Acme\MyBundle\SessionRequestProcessor' + 'AppBundle\SessionRequestProcessor' ) ->addArgument(new Reference('session')) ->addTag('monolog.processor', array('method' => 'processRecord')); @@ -445,7 +445,7 @@ the ``monolog.processor`` tag: # app/config/config.yml services: monolog.processor.session_request: - class: Acme\MyBundle\SessionRequestProcessor + class: AppBundle\SessionRequestProcessor arguments: ["@session"] tags: - { name: monolog.processor, method: processRecord, handler: main } @@ -464,7 +464,7 @@ the ``monolog.processor`` tag: + class="AppBundle\SessionRequestProcessor"> @@ -478,7 +478,7 @@ the ``monolog.processor`` tag: $container ->register( 'monolog.processor.session_request', - 'Acme\MyBundle\SessionRequestProcessor' + 'AppBundle\SessionRequestProcessor' ) ->addArgument(new Reference('session')) ->addTag('monolog.processor', array('method' => 'processRecord', 'handler' => 'main')); @@ -496,7 +496,7 @@ the ``monolog.processor`` tag: # app/config/config.yml services: monolog.processor.session_request: - class: Acme\MyBundle\SessionRequestProcessor + class: AppBundle\SessionRequestProcessor arguments: ["@session"] tags: - { name: monolog.processor, method: processRecord, channel: main } @@ -515,7 +515,7 @@ the ``monolog.processor`` tag: + class="AppBundle\SessionRequestProcessor"> @@ -529,7 +529,7 @@ the ``monolog.processor`` tag: $container ->register( 'monolog.processor.session_request', - 'Acme\MyBundle\SessionRequestProcessor' + 'AppBundle\SessionRequestProcessor' ) ->addArgument(new Reference('session')) ->addTag('monolog.processor', array('method' => 'processRecord', 'channel' => 'main')); diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index 74e7d07006a..05343769443 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -180,8 +180,7 @@ All blocks have access to the ``collector`` object. echo base64_encode(file_get_contents($_SERVER['argv'][1])); To enable the template, add a ``template`` attribute to the ``data_collector`` -tag in your configuration. For example, assuming your template is in some -AcmeDebugBundle: +tag in your configuration. For example, assuming your template is in AppBundle: .. configuration-block:: @@ -189,22 +188,22 @@ AcmeDebugBundle: services: data_collector.your_collector_name: - class: Acme\DebugBundle\Collector\Class\Name + class: AppBundle\Collector\Class\Name tags: - - { name: data_collector, template: "AcmeDebugBundle:Collector:templatename", id: "your_collector_name" } + - { name: data_collector, template: "AppBundle:Collector:templatename", id: "your_collector_name" } .. code-block:: xml - - + + .. code-block:: php $container - ->register('data_collector.your_collector_name', 'Acme\DebugBundle\Collector\Class\Name') + ->register('data_collector.your_collector_name', 'AppBundle\Collector\Class\Name') ->addTag('data_collector', array( - 'template' => 'AcmeDebugBundle:Collector:templatename', + 'template' => 'AppBundle:Collector:templatename', 'id' => 'your_collector_name', )) ; diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index edb71a4c87b..057ec39aca5 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -239,7 +239,7 @@ added above: .. code-block:: php - $identity = new UserSecurityIdentity('johannes', 'Acme\UserBundle\Entity\User'); + $identity = new UserSecurityIdentity('johannes', 'AppBundle\Entity\User'); $acl->insertObjectAce($identity, $mask); The user is now allowed to view, edit, delete, and un-delete objects. diff --git a/cookbook/security/csrf_in_login_form.rst b/cookbook/security/csrf_in_login_form.rst index ad5bffcc60c..a5d1474ec5f 100644 --- a/cookbook/security/csrf_in_login_form.rst +++ b/cookbook/security/csrf_in_login_form.rst @@ -89,7 +89,7 @@ using the login form: .. code-block:: html+jinja - {# src/Acme/SecurityBundle/Resources/views/Security/login.html.twig #} + {# src/AppBundle/Resources/views/Security/login.html.twig #} {# ... #}
@@ -104,7 +104,7 @@ using the login form: .. code-block:: html+php - + diff --git a/cookbook/security/form_login.rst b/cookbook/security/form_login.rst index e05e6067e58..766f69a8101 100644 --- a/cookbook/security/form_login.rst +++ b/cookbook/security/form_login.rst @@ -229,7 +229,7 @@ redirect to the URL defined by some ``account`` route, use the following: .. code-block:: html+jinja - {# src/Acme/SecurityBundle/Resources/views/Security/login.html.twig #} + {# src/AppBundle/Resources/views/Security/login.html.twig #} {% if error %}
{{ error.message }}
{% endif %} @@ -248,7 +248,7 @@ redirect to the URL defined by some ``account`` route, use the following: .. code-block:: html+php - +
getMessage() ?>
diff --git a/cookbook/security/form_login_setup.rst b/cookbook/security/form_login_setup.rst index 018d3e8dbe2..ea3981c7760 100644 --- a/cookbook/security/form_login_setup.rst +++ b/cookbook/security/form_login_setup.rst @@ -245,7 +245,7 @@ Finally, create the template: .. code-block:: html+php - +
getMessage() ?>
diff --git a/cookbook/security/multiple_user_providers.rst b/cookbook/security/multiple_user_providers.rst index 14940627057..b90c71e6d49 100644 --- a/cookbook/security/multiple_user_providers.rst +++ b/cookbook/security/multiple_user_providers.rst @@ -22,7 +22,7 @@ a new provider that chains the two together: users: foo: { password: test } user_db: - entity: { class: Acme\UserBundle\Entity\User, property: username } + entity: { class: AppBundle\Entity\User, property: username } .. code-block:: xml @@ -49,7 +49,7 @@ a new provider that chains the two together: - + @@ -73,7 +73,7 @@ a new provider that chains the two together: ), 'user_db' => array( 'entity' => array( - 'class' => 'Acme\UserBundle\Entity\User', + 'class' => 'AppBundle\Entity\User', 'property' => 'username', ), ), diff --git a/cookbook/templating/global_variables.rst b/cookbook/templating/global_variables.rst index 4250f834c03..0226b3cf9ec 100644 --- a/cookbook/templating/global_variables.rst +++ b/cookbook/templating/global_variables.rst @@ -106,14 +106,14 @@ This should feel familiar, as it's the same syntax you use in service configurat twig: # ... globals: - user_management: "@acme_user.user_management" + user_management: "@app.user_management" .. code-block:: xml - @acme_user.user_management + @app.user_management .. code-block:: php @@ -122,7 +122,7 @@ This should feel familiar, as it's the same syntax you use in service configurat $container->loadFromExtension('twig', array( // ... 'globals' => array( - 'user_management' => '@acme_user.user_management', + 'user_management' => '@app.user_management', ), )); diff --git a/cookbook/testing/doctrine.rst b/cookbook/testing/doctrine.rst index b4f1cda682a..b240a3fe652 100644 --- a/cookbook/testing/doctrine.rst +++ b/cookbook/testing/doctrine.rst @@ -20,8 +20,8 @@ If you need to actually execute a query, you will need to boot the kernel to get a valid connection. In this case, you'll extend the ``WebTestCase``, which makes all of this quite easy:: - // src/Acme/StoreBundle/Tests/Entity/ProductRepositoryFunctionalTest.php - namespace Acme\StoreBundle\Tests\Entity; + // src/AppBundle/Tests/Entity/ProductRepositoryFunctionalTest.php + namespace AppBundle\Tests\Entity; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -48,7 +48,7 @@ which makes all of this quite easy:: public function testSearchByCategoryName() { $products = $this->em - ->getRepository('AcmeStoreBundle:Product') + ->getRepository('AppBundle:Product') ->searchByCategoryName('foo') ;