diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index 289f4aacd63..e7dbb7c41c7 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -11,7 +11,7 @@ better software than with flat PHP, you'll see for yourself. In this chapter, you'll write a simple application in flat PHP, and then refactor it to be more organized. You'll travel through time, seeing the decisions behind why web development has evolved over the past several years -to where it is now. +to where it is now. By the end, you'll see how Symfony2 can rescue you from mundane tasks and let you take back control of your code. @@ -132,7 +132,7 @@ to the area of *your* code that processes user input and prepares the response. In this case, our controller prepares data from the database and then includes a template to present that data. With the controller isolated, you could easily change *just* the template file if you needed to render the blog -entries in some other format (e.g. ``list.json.php`` for JSON format). +entries in some other format (e.g. ``list.json.php`` for JSON format). Isolating the Application (Domain) Logic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -424,7 +424,7 @@ an autoloader that Symfony provides. An autoloader is a tool that makes it possible to start using PHP classes without explicitly including the file containing the class. -First, `download symfony`_ and place it into a ``vendor/symfony/`` directory. +First, `download symfony`_ and place it into a ``vendor/symfony/symfony/`` directory. Next, create an ``app/bootstrap.php`` file. Use it to ``require`` the two files in the application and to configure the autoloader: @@ -434,11 +434,11 @@ files in the application and to configure the autoloader: // bootstrap.php require_once 'model.php'; require_once 'controllers.php'; - require_once 'vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; + require_once 'vendor/symfony/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array( - 'Symfony' => __DIR__.'/../vendor/symfony/src', + 'Symfony' => __DIR__.'/../vendor/symfony/symfony/src', )); $loader->register(); @@ -564,7 +564,7 @@ them for you. Here's the same sample application, now built in Symfony2: ->getEntityManager() ->getRepository('AcmeBlogBundle:Post') ->find($id); - + if (!$post) { // cause the 404 page not found to be displayed throw $this->createNotFoundException(); @@ -581,7 +581,7 @@ now quite a bit simpler: .. code-block:: html+php - + extend('::layout.html.php') ?> set('title', 'List of Posts') ?> diff --git a/book/performance.rst b/book/performance.rst index 90fe2c74fb4..db6f7fd0b55 100644 --- a/book/performance.rst +++ b/book/performance.rst @@ -64,7 +64,7 @@ To use this class loader, simply adapt your ``autoloader.php`` as follows: .. code-block:: php // app/autoload.php - require __DIR__.'/../vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; + require __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; use Symfony\Component\ClassLoader\ApcUniversalClassLoader; diff --git a/components/class_loader.rst b/components/class_loader.rst index 7d99c3ae98a..5946a6937c4 100644 --- a/components/class_loader.rst +++ b/components/class_loader.rst @@ -74,11 +74,11 @@ or :method:`Symfony\\Component\\ClassLoader\\UniversalClassLoader::registerNamespaces` methods:: - $loader->registerNamespace('Symfony', __DIR__.'/vendor/symfony/src'); + $loader->registerNamespace('Symfony', __DIR__.'/vendor/symfony/symfony/src'); $loader->registerNamespaces(array( - 'Symfony' => __DIR__.'/../vendor/symfony/src', - 'Monolog' => __DIR__.'/../vendor/monolog/src', + 'Symfony' => __DIR__.'/../vendor/symfony/symfony/src', + 'Monolog' => __DIR__.'/../vendor/monolog/monolog/src', )); $loader->register(); @@ -89,11 +89,11 @@ or :method:`Symfony\\Component\\ClassLoader\\UniversalClassLoader::registerPrefixes` methods:: - $loader->registerPrefix('Twig_', __DIR__.'/vendor/twig/lib'); + $loader->registerPrefix('Twig_', __DIR__.'/vendor/twig/twig/lib'); $loader->registerPrefixes(array( - 'Swift_' => __DIR__.'/vendor/swiftmailer/lib/classes', - 'Twig_' => __DIR__.'/vendor/twig/lib', + 'Swift_' => __DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes', + 'Twig_' => __DIR__.'/vendor/twig/twig/lib', )); $loader->register(); @@ -108,10 +108,10 @@ for in a location list to ease the vendoring of a sub-set of classes for large projects:: $loader->registerNamespaces(array( - 'Doctrine\\Common' => __DIR__.'/vendor/doctrine-common/lib', - 'Doctrine\\DBAL\\Migrations' => __DIR__.'/vendor/doctrine-migrations/lib', - 'Doctrine\\DBAL' => __DIR__.'/vendor/doctrine-dbal/lib', - 'Doctrine' => __DIR__.'/vendor/doctrine/lib', + 'Doctrine\\Common' => __DIR__.'/vendor/doctrine/common/lib', + 'Doctrine\\DBAL\\Migrations' => __DIR__.'/vendor/doctrine/migrations/lib', + 'Doctrine\\DBAL' => __DIR__.'/vendor/doctrine/dbal/lib', + 'Doctrine' => __DIR__.'/vendor/doctrine/orm/lib', )); $loader->register(); diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index 405131e4620..939b0d78542 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -86,7 +86,7 @@ Symfony uses the following algorithm to determine which template to use: To see the full list of default error templates, see the ``Resources/views/Exception`` directory of the ``TwigBundle``. In a standard Symfony2 installation, the ``TwigBundle`` can be found at - ``vendor/symfony/src/Symfony/Bundle/TwigBundle``. Often, the easiest way + ``vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle``. Often, the easiest way to customize an error page is to copy it from the ``TwigBundle`` into ``app/Resources/TwigBundle/views/Exception`` and then modify it. diff --git a/cookbook/debugging.rst b/cookbook/debugging.rst index 205b2b22192..79eff11c6bf 100644 --- a/cookbook/debugging.rst +++ b/cookbook/debugging.rst @@ -46,7 +46,7 @@ below:: // ... // require_once __DIR__.'/../app/bootstrap.php.cache'; - require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; + require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; require_once __DIR__.'/../app/autoload.php'; require_once __DIR__.'/../app/AppKernel.php'; diff --git a/cookbook/symfony1.rst b/cookbook/symfony1.rst index efdd2f9b805..a7fe74d9188 100644 --- a/cookbook/symfony1.rst +++ b/cookbook/symfony1.rst @@ -127,13 +127,13 @@ example:: // ... The file itself lives at -``vendor/bundle/Sensio/Bundle/FrameworkExtraBundle/SensioFrameworkExtraBundle.php``. +``vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/SensioFrameworkExtraBundle.php``. As you can see, the location of the file follows the namespace of the class. Specifically, the namespace, ``Sensio\Bundle\FrameworkExtraBundle``, spells out -the directory that the file should live in -(``vendor/bundle/Sensio/Bundle/FrameworkExtraBundle``). This is because, in the -``app/autoload.php`` file, you'll configure Symfony to look for the ``Sensio`` -namespace in the ``vendor/bundle`` directory: +the directory that the file should live in +(``vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/``). +This is because, in the ``app/autoload.php`` file, you'll configure Symfony to +look for the ``Sensio`` namespace in the ``vendor/sension`` directory: .. code-block:: php @@ -155,7 +155,7 @@ contains a different class). In order for a class to be autoloaded, you As mentioned before, for the autoloader to work, it needs to know that the ``Sensio`` namespace lives in the ``vendor/bundles`` directory and that, for -example, the ``Doctrine`` namespace lives in the ``vendor/doctrine/lib/`` +example, the ``Doctrine`` namespace lives in the ``vendor/doctrine/orm/lib/`` directory. This mapping is entirely controlled by you via the ``app/autoload.php`` file. @@ -247,7 +247,7 @@ In Symfony2, the bundles are activated inside the application kernel:: // ... new Acme\DemoBundle\AcmeDemoBundle(), ); - + return $bundles; } diff --git a/cookbook/testing/doctrine.rst b/cookbook/testing/doctrine.rst index b63ae34212f..e867b3a88fc 100644 --- a/cookbook/testing/doctrine.rst +++ b/cookbook/testing/doctrine.rst @@ -5,7 +5,7 @@ How to test Doctrine Repositories ================================= Unit testing Doctrine repositories in a Symfony project is not a straightforward -task. Indeed, to load a repository you need to load your entities, an entity +task. Indeed, to load a repository you need to load your entities, an entity manager, and some other stuff like a connection. To test your repository, you have two different options: @@ -22,7 +22,7 @@ To test your repository, you have two different options: Unit Testing ------------ -As Symfony and Doctrine share the same testing framework, it's quite easy to +As Symfony and Doctrine share the same testing framework, it's quite easy to implement unit tests in your Symfony project. The ORM comes with its own set of tools to ease the unit testing and mocking of everything you need, such as a connection, an entity manager, etc. By using the testing components provided @@ -41,7 +41,7 @@ First, you need to add the ``Doctrine\Tests`` namespace to your autoloader:: // app/autoload.php $loader->registerNamespaces(array( //... - 'Doctrine\\Tests' => __DIR__.'/../vendor/doctrine/tests', + 'Doctrine\\Tests' => __DIR__.'/../vendor/doctrine/orm/tests', )); Next, you will need to setup an entity manager in each test so that Doctrine @@ -70,7 +70,7 @@ and load the entities:: $reader->setEnableParsePhpImports(true); $metadataDriver = new AnnotationDriver( - $reader, + $reader, // provide the namespace of the entities you want to tests 'Acme\\ProductBundle\\Entity' ); diff --git a/quick_tour/the_architecture.rst b/quick_tour/the_architecture.rst index 51a3b467264..4a2f2e8784b 100644 --- a/quick_tour/the_architecture.rst +++ b/quick_tour/the_architecture.rst @@ -65,19 +65,19 @@ PHP autoloading can be configured via ``app/autoload.php``:: $loader = new UniversalClassLoader(); $loader->registerNamespaces(array( - 'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'), + 'Symfony' => array(__DIR__.'/../vendor/symfony/symfony/src', __DIR__.'/../vendor/bundles'), 'Sensio' => __DIR__.'/../vendor/bundles', - 'JMS' => __DIR__.'/../vendor/bundles', - 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib', - 'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib', - 'Doctrine' => __DIR__.'/../vendor/doctrine/lib', - 'Monolog' => __DIR__.'/../vendor/monolog/src', - 'Assetic' => __DIR__.'/../vendor/assetic/src', - 'Metadata' => __DIR__.'/../vendor/metadata/src', + 'JMS' => __DIR__.'/../vendor/jms/', + 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine/common/lib', + 'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine/dbal/lib', + 'Doctrine' => __DIR__.'/../vendor/doctrine/orm/lib', + 'Monolog' => __DIR__.'/../vendor/monolog/monolog/src', + 'Assetic' => __DIR__.'/../vendor/kriswallsmith/assetic/src', + 'Metadata' => __DIR__.'/../vendor/jms/metadata/src', )); $loader->registerPrefixes(array( - 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib', - 'Twig_' => __DIR__.'/../vendor/twig/lib', + 'Twig_Extensions_' => __DIR__.'/../vendor/twig/extensions/lib', + 'Twig_' => __DIR__.'/../vendor/twig/twig/lib', )); // ...