diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 54ce75f608d..c541be4ac64 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -173,7 +173,7 @@ and deployment processes. To use a filter, you first need to specify it in the Assetic configuration. Adding a filter here doesn't mean it's being used - it just means that it's -available to use (we'll use the filter below). +available to use (you'll use the filter below). For example to use the JavaScript YUI Compressor the following config should be added: diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 984f1b319f0..2846f2a0764 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -84,8 +84,8 @@ something beyond just the class name, you should use a compiler pass:: } } -In this example we fetch the service definition of the original service, and set -its class name to our own class. +In this example you fetch the service definition of the original service, and set +its class name to your own class. See :doc:`/cookbook/service_container/compiler_passes` for information on how to use compiler passes. If you want to do something beyond just overriding the class - diff --git a/cookbook/configuration/apache_router.rst b/cookbook/configuration/apache_router.rst index 23e0f6dd828..c2e5d79a4c9 100644 --- a/cookbook/configuration/apache_router.rst +++ b/cookbook/configuration/apache_router.rst @@ -10,11 +10,11 @@ One of these ways is by letting apache handle routes directly, rather than using Change Router Configuration Parameters -------------------------------------- -To dump Apache routes we must first tweak some configuration parameters to tell +To dump Apache routes you must first tweak some configuration parameters to tell Symfony2 to use the ``ApacheUrlMatcher`` instead of the default one: .. code-block:: yaml - + # app/config/config_prod.yml parameters: router.options.matcher.cache_class: ~ # disable router cache @@ -26,27 +26,27 @@ Symfony2 to use the ``ApacheUrlMatcher`` instead of the default one: extends :class:`Symfony\\Component\\Routing\\Matcher\\UrlMatcher` so even if you don't regenerate the url_rewrite rules, everything will work (because at the end of ``ApacheUrlMatcher::match()`` a call to ``parent::match()`` - is done). - + is done). + Generating mod_rewrite rules ---------------------------- - + To test that it's working, let's create a very basic route for demo bundle: .. code-block:: yaml - + # app/config/routing.yml hello: pattern: /hello/{name} defaults: { _controller: AcmeDemoBundle:Demo:hello } - - -Now we generate **url_rewrite** rules: - + + +Now generate **url_rewrite** rules: + .. code-block:: bash $ php app/console router:dump-apache -e=prod --no-debug - + Which should roughly output the following: .. code-block:: apache @@ -59,7 +59,7 @@ Which should roughly output the following: RewriteCond %{REQUEST_URI} ^/hello/([^/]+?)$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:hello,E=_ROUTING_name:%1,E=_ROUTING__controller:AcmeDemoBundle\:Demo\:hello] -You can now rewrite `web/.htaccess` to use the new rules, so with our example +You can now rewrite `web/.htaccess` to use the new rules, so with this example it should look like this: .. code-block:: apache @@ -82,7 +82,7 @@ it should look like this: That's it! You're now all set to use Apache Route rules. - + Additional tweaks ----------------- @@ -90,7 +90,7 @@ To save a little bit of processing time, change occurrences of ``Request`` to ``ApacheRequest`` in ``web/app.php``:: // web/app.php - + require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/AppKernel.php'; //require_once __DIR__.'/../app/AppCache.php'; diff --git a/cookbook/configuration/override_dir_structure.rst b/cookbook/configuration/override_dir_structure.rst index 93914de9c83..90601930976 100644 --- a/cookbook/configuration/override_dir_structure.rst +++ b/cookbook/configuration/override_dir_structure.rst @@ -4,8 +4,8 @@ How to override Symfony's Default Directory Structure ===================================================== -Symfony automatically ships with a default directory structure. You can -easily override this directory structure to create your own. The default +Symfony automatically ships with a default directory structure. You can +easily override this directory structure to create your own. The default directory structure is: .. code-block:: text @@ -26,7 +26,7 @@ directory structure is: Override the ``cache`` directory -------------------------------- -You can override the cache directory by overriding the ``getCacheDir`` method +You can override the cache directory by overriding the ``getCacheDir`` method in the ``AppKernel`` class of you application:: // app/AppKernel.php @@ -43,7 +43,7 @@ in the ``AppKernel`` class of you application:: } ``$this->rootDir`` is the absolute path to the ``app`` directory and ``$this->environment`` -is the current environment (i.e. ``dev``). In this case we have changed +is the current environment (i.e. ``dev``). In this case you have changed the location of the cache directory to ``app/{environment}/cache``. .. caution:: @@ -56,8 +56,8 @@ the location of the cache directory to ``app/{environment}/cache``. Override the ``logs`` directory ------------------------------- -Overriding the ``logs`` directory is the same as overriding the ``cache`` -directory, the only difference is that you need to override the ``getLogDir`` +Overriding the ``logs`` directory is the same as overriding the ``cache`` +directory, the only difference is that you need to override the ``getLogDir`` method:: // app/AppKernel.php @@ -73,7 +73,7 @@ method:: } } -Here we have changed the location of the directory to ``app/{environment}/logs``. +Here you have changed the location of the directory to ``app/{environment}/logs``. Override the ``web`` directory ------------------------------ @@ -98,7 +98,7 @@ may need to modify the paths inside these files:: .. note:: - If you use the AsseticBundle you need to configure this, so it can use + If you use the AsseticBundle you need to configure this, so it can use the correct ``web`` directory: .. code-block:: yaml @@ -110,7 +110,7 @@ may need to modify the paths inside these files:: # ... read_from: "%kernel.root_dir%/../../public_html" - Now you just need to dump the assets again and your application should + Now you just need to dump the assets again and your application should work: .. code-block:: bash diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index af60f1fb737..a82f81b9ba0 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -28,7 +28,7 @@ control you need: information, see :ref:`kernel-kernel.exception`. All of the error templates live inside ``TwigBundle``. To override the -templates, we simply rely on the standard method for overriding templates that +templates, simply rely on the standard method for overriding templates that live inside a bundle. For more information, see :ref:`overriding-bundle-templates`. diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index bc886fe9169..3291ce3a1a2 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -10,8 +10,8 @@ extends the base this works fine, controllers can also be specified as services. To refer to a controller that's defined as a service, use the single colon (:) -notation. For example, suppose we've defined a service called -``my_controller`` and we want to forward to a method called ``indexAction()`` +notation. For example, suppose you've defined a service called +``my_controller`` and you want to forward to a method called ``indexAction()`` inside the service:: $this->forward('my_controller:indexAction', array('foo' => $bar)); @@ -62,4 +62,4 @@ service, you need to specify your service as follows:: In this example, ``my_bundle.annot_controller`` should be the id of the ``AnnotController`` instance defined in the service container. This is documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing` -chapter. \ No newline at end of file +chapter. diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index 5ebb1c29a46..abb042bbd4a 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -210,9 +210,9 @@ object, which is what's returned after a ``file`` field is submitted:: return; } - // we use the original file name here but you should + // use the original file name here but you should // sanitize it at least to avoid any security issues - + // move takes the target directory and then the target filename to move to $this->file->move($this->getUploadRootDir(), $this->file->getClientOriginalName()); diff --git a/cookbook/doctrine/reverse_engineering.rst b/cookbook/doctrine/reverse_engineering.rst index 7f5fac8dd7f..c3ae948f75a 100644 --- a/cookbook/doctrine/reverse_engineering.rst +++ b/cookbook/doctrine/reverse_engineering.rst @@ -49,7 +49,7 @@ to a post record thanks to a foreign key constraint. Before diving into the recipe, be sure your database connection parameters are correctly setup in the ``app/config/parameters.ini`` file (or wherever your database configuration is kept) and that you have initialized a bundle that -will host your future entity class. In this tutorial, we will assume that +will host your future entity class. In this tutorial it's assumed that an ``AcmeBlogBundle`` exists and is located under the ``src/Acme/BlogBundle`` folder. diff --git a/cookbook/event_dispatcher/before_after_filters.rst b/cookbook/event_dispatcher/before_after_filters.rst index 4bebee88d79..7ca34c3013a 100755 --- a/cookbook/event_dispatcher/before_after_filters.rst +++ b/cookbook/event_dispatcher/before_after_filters.rst @@ -275,6 +275,6 @@ event: That's it! The ``TokenListener`` is now notified before every controller is executed (``onKernelController``) and after every controller returns a response (``onKernelResponse``). By making specific controllers implement the ``TokenAuthenticatedController`` -interface, our listener knows which controllers it should take action on. +interface, your listener knows which controllers it should take action on. And by storing a value in the request's "attributes" bag, the ``onKernelResponse`` method knows to add the extra header. Have fun! diff --git a/cookbook/event_dispatcher/class_extension.rst b/cookbook/event_dispatcher/class_extension.rst index 7cc52c65210..6ae1edc88bd 100644 --- a/cookbook/event_dispatcher/class_extension.rst +++ b/cookbook/event_dispatcher/class_extension.rst @@ -97,7 +97,7 @@ and *add* the method ``bar()``: { public function onFooMethodIsNotFound(HandleUndefinedMethodEvent $event) { - // we only want to respond to the calls to the 'bar' method + // only respond to the calls to the 'bar' method if ('bar' != $event->getMethod()) { // allow another listener to take care of this unknown method return; diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 38d669b940b..f9f92e3f25d 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -33,7 +33,7 @@ To log a message simply get the logger service from the container in your controller:: $logger = $this->get('logger'); - $logger->info('We just got the logger'); + $logger->info('I just got the logger'); $logger->err('An error occurred'); .. tip:: diff --git a/cookbook/routing/redirect_in_config.rst b/cookbook/routing/redirect_in_config.rst index 42fa0274cfd..ba92db3ac5b 100644 --- a/cookbook/routing/redirect_in_config.rst +++ b/cookbook/routing/redirect_in_config.rst @@ -28,7 +28,7 @@ Your configuration will look like this: Your ``AppBundle`` is registered to handle all requests under ``/app``. -We configure a route for the ``/`` path and let :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController` +You configure a route for the ``/`` path and let :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController` handle it. This controller is built-in and offers two methods for redirecting request: * ``redirect`` redirects to another *route*. You must provide the ``route`` diff --git a/cookbook/service_container/event_listener.rst b/cookbook/service_container/event_listener.rst index 3621490364b..4ec53df4fcd 100644 --- a/cookbook/service_container/event_listener.rst +++ b/cookbook/service_container/event_listener.rst @@ -10,7 +10,7 @@ component and can be viewed in the :class:`Symfony\\Component\\HttpKernel\\Kerne To hook into an event and add your own custom logic, you have to create a service that will act as an event listener on that event. In this entry, -we will create a service that will act as an Exception Listener, allowing +you will create a service that will act as an Exception Listener, allowing us to modify how exceptions are shown by our application. The ``KernelEvents::EXCEPTION`` event is just one of the core kernel events:: @@ -25,11 +25,11 @@ event is just one of the core kernel events:: { public function onKernelException(GetResponseForExceptionEvent $event) { - // We get the exception object from the received event + // You get the exception object from the received event $exception = $event->getException(); $message = 'My Error says: ' . $exception->getMessage() . ' with code: ' . $exception->getCode(); - // Customize our response object to display our exception details + // Customize your response object to display the exception details $response = new Response(); $response->setContent($message); @@ -42,7 +42,7 @@ event is just one of the core kernel events:: $response->setStatusCode(500); } - // Send our modified response object to the event + // Send the modified response object to the event $event->setResponse($response); } } @@ -53,7 +53,7 @@ event is just one of the core kernel events:: the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`. To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`. -Now that the class is created, we just need to register it as a service and +Now that the class is created, you just need to register it as a service and notify Symfony that it is a "listener" on the ``kernel.exception`` event by using a special "tag": diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index acbfc5503ff..7da0e98254f 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -37,7 +37,7 @@ when compiling the container. Read the sidebar below for more details. the scope of the service, so it defaults to `container`. In other words, everytime you ask the container for the `my_mailer` service, you get the same object back. This is usually how you want your services to work. - + Imagine, however, that you need the `request` service in your `my_mailer` service, maybe because you're reading the URL of the current request. So, you add it as a constructor argument. Let's look at why this presents @@ -67,7 +67,7 @@ when compiling the container. Read the sidebar below for more details. .. note:: A service can of course depend on a service from a wider scope without - any issue. + any issue. Setting the Scope in the Definition ----------------------------------- @@ -116,7 +116,7 @@ new service in the `request` scope. But this is not always possible (for instance, a twig extension must be in the `container` scope as the Twig environment needs it as a dependency). In these cases, you should pass the entire container into your service and -retrieve your dependency from the container each time we need it to be sure +retrieve your dependency from the container each time you need it to be sure you have the right instance:: // src/Acme/HelloBundle/Mail/Mailer.php diff --git a/cookbook/symfony1.rst b/cookbook/symfony1.rst index 4e8463579e4..ffede093e4a 100644 --- a/cookbook/symfony1.rst +++ b/cookbook/symfony1.rst @@ -10,12 +10,12 @@ at its core, the skills used to master a symfony1 project continue to be very relevant when developing in Symfony2. Sure, ``app.yml`` is gone, but routing, controllers and templates all remain. -In this chapter, we'll walk through the differences between symfony1 and Symfony2. +This chapter walks through the differences between symfony1 and Symfony2. As you'll see, many tasks are tackled in a slightly different way. You'll come to appreciate these minor differences as they promote stable, predictable, testable and decoupled code in your Symfony2 applications. -So, sit back and relax as we take you from "then" to "now". +So, sit back and relax as your taken from "then" to "now". Directory Structure ------------------- @@ -61,7 +61,7 @@ In other words, the code that drives your application lives in many different places. In Symfony2, life is much simpler because *all* Symfony2 code must live in -a bundle. In our pretend symfony1 project, all the code *could* be moved +a bundle. In the pretend symfony1 project, all the code *could* be moved into one or more plugins (which is a very good practice, in fact). Assuming that all modules, PHP classes, schema, routing configuration, etc were moved into a plugin, the symfony1 ``plugins/`` directory would be very similar @@ -134,7 +134,7 @@ The file itself lives at ``vendor/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 +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: @@ -251,7 +251,7 @@ In Symfony2, the bundles are activated inside the application kernel:: ..., new Acme\DemoBundle\AcmeDemoBundle(), ); - + return $bundles; } diff --git a/cookbook/templating/PHP.rst b/cookbook/templating/PHP.rst index 456a9fcb84c..635e08926b9 100644 --- a/cookbook/templating/PHP.rst +++ b/cookbook/templating/PHP.rst @@ -18,7 +18,7 @@ your application configuration file: .. configuration-block:: .. code-block:: yaml - + # app/config/config.yml framework: # ... @@ -42,7 +42,7 @@ your application configuration file: 'templating' => array( 'engines' => array('twig', 'php'), ), - )); + )); You can now render a PHP template instead of a Twig one simply by using the ``.php`` extension in the template name instead of ``.twig``. The controller @@ -82,7 +82,7 @@ Decorating Templates -------------------- More often than not, templates in a project share common elements, like the -well-known header and footer. In Symfony2, we like to think about this problem +well-known header and footer. In Symfony2, this problem is thought about differently: a template can be decorated by another one. The ``index.html.php`` template is decorated by ``layout.html.php``, thanks to diff --git a/cookbook/templating/global_variables.rst b/cookbook/templating/global_variables.rst index 9cbe2b36039..93dddeaefb3 100644 --- a/cookbook/templating/global_variables.rst +++ b/cookbook/templating/global_variables.rst @@ -19,7 +19,7 @@ Now, the variable ``ga_tracking`` is available in all Twig templates: .. code-block:: html+jinja -

Our google tracking code is: {{ ga_tracking }}

+

The google tracking code is: {{ ga_tracking }}

It's that easy! You can also take advantage of the built-in :ref:`book-service-container-parameters` system, which lets you isolate or reuse the value: diff --git a/cookbook/templating/twig_extension.rst b/cookbook/templating/twig_extension.rst index 144da793e36..8bb744941cd 100644 --- a/cookbook/templating/twig_extension.rst +++ b/cookbook/templating/twig_extension.rst @@ -1,11 +1,11 @@ .. index:: single: Twig extensions - + How to write a custom Twig Extension ==================================== The main motivation for writing an extension is to move often used code -into a reusable class like adding support for internationalization. +into a reusable class like adding support for internationalization. An extension can define tags, filters, tests, operators, global variables, functions, and node visitors. @@ -16,12 +16,12 @@ your code faster. .. tip:: Before writing your own extensions, have a look at the `Twig official extension repository`_. - + Create the Extension Class --------------------------- +-------------------------- -To get your custom functionality you must first create a Twig Extension class. -As an example we will create a price filter to format a given number into price:: +To get your custom functionality you must first create a Twig Extension class. +As an example you'll create a price filter to format a given number into price:: // src/Acme/DemoBundle/Twig/AcmeExtension.php namespace Acme\DemoBundle\Twig; @@ -51,8 +51,8 @@ As an example we will create a price filter to format a given number into price: .. tip:: - Along with custom filters, you can also add custom `functions` and register `global variables`. - + Along with custom filters, you can also add custom `functions` and register `global variables`. + Register an Extension as a Service ---------------------------------- @@ -61,7 +61,7 @@ Now you must let Service Container know about your newly created Twig Extension: .. configuration-block:: .. code-block:: xml - + @@ -70,7 +70,7 @@ Now you must let Service Container know about your newly created Twig Extension: .. code-block:: yaml - + # src/Acme/DemoBundle/Resources/config/services.yml services: acme.twig.acme_extension: @@ -86,15 +86,15 @@ Now you must let Service Container know about your newly created Twig Extension: $acmeDefinition = new Definition('\Acme\DemoBundle\Twig\AcmeExtension'); $acmeDefinition->addTag('twig.extension'); $container->setDefinition('acme.twig.acme_extension', $acmeDefinition); - + .. note:: - Keep in mind that Twig Extensions are not lazily loaded. This means that + Keep in mind that Twig Extensions are not lazily loaded. This means that there's a higher chance that you'll get a **CircularReferenceException** - or a **ScopeWideningInjectionException** if any services + or a **ScopeWideningInjectionException** if any services (or your Twig Extension in this case) are dependent on the request service. For more information take a look at :doc:`/cookbook/service_container/scopes`. - + Using the custom Extension -------------------------- @@ -104,19 +104,19 @@ Using your newly created Twig Extension is no different than any other: {# outputs $5,500.00 #} {{ '5500'|price }} - + Passing other arguments to your filter: .. code-block:: jinja - + {# outputs $5500,2516 #} {{ '5500.25155'|price(4, ',', '') }} - + Learning further ---------------- - + For a more in-depth look into Twig Extensions, please take a look at the `Twig extensions documentation`_. - + .. _`Twig official extension repository`: https://github.com/fabpot/Twig-extensions .. _`Twig extensions documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension .. _`global variables`: http://twig.sensiolabs.org/doc/advanced.html#id1 diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index 5fe72d174e9..aea61ece0f4 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -5,18 +5,18 @@ How to create a Custom Validation Constraint ============================================ You can create a custom constraint by extending the base constraint class, -:class:`Symfony\\Component\\Validator\\Constraint`. -As an example we're going to create a simple validator that checks if a string +:class:`Symfony\\Component\\Validator\\Constraint`. +As an example you're going to create a simple validator that checks if a string contains only alphanumeric characters. Creating Constraint class ------------------------- -First you need to create a Constraint class and extend :class:`Symfony\\Component\\Validator\\Constraint`:: +First you need to create a Constraint class and extend :class:`Symfony\\Component\\Validator\\Constraint`:: // src/Acme/DemoBundle/Validator/Constraints/ContainsAlphanumeric.php namespace Acme\DemoBundle\Validator\Constraints; - + use Symfony\Component\Validator\Constraint; /** @@ -32,11 +32,11 @@ First you need to create a Constraint class and extend :class:`Symfony\\Componen The ``@Annotation`` annotation is necessary for this new constraint in order to make it available for use in classes via annotations. Options for your constraint are represented as public properties on the - constraint class. + constraint class. Creating the Validator itself ----------------------------- - + As you can see, a constraint class is fairly minimal. The actual validation is performed by a another "constraint validator" class. The constraint validator class is specified by the constraint's ``validatedBy()`` method, which @@ -56,7 +56,7 @@ The validator class is also simple, and only has one required method: ``isValid` // src/Acme/DemoBundle/Validator/Constraints/ContainsAlphanumericValidator.php namespace Acme\DemoBundle\Validator\Constraints; - + use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -78,7 +78,7 @@ The validator class is also simple, and only has one required method: ``isValid` Don't forget to call ``setMessage`` to construct an error message when the value is invalid. - + Using the new Validator ----------------------- @@ -87,7 +87,7 @@ Using custom validators is very easy, just as the ones provided by Symfony2 itse .. configuration-block:: .. code-block:: yaml - + # src/Acme/BlogBundle/Resources/config/validation.yml Acme\DemoBundle\Entity\AcmeEntity: properties: @@ -100,22 +100,22 @@ Using custom validators is very easy, just as the ones provided by Symfony2 itse // src/Acme/DemoBundle/Entity/AcmeEntity.php use Symfony\Component\Validator\Constraints as Assert; use Acme\DemoBundle\Validator\Constraints as AcmeAssert; - + class AcmeEntity { // ... - + /** * @Assert\NotBlank * @AcmeAssert\ContainsAlphanumeric */ protected $name; - + // ... } .. code-block:: xml - + .. code-block:: php - + // src/Acme/DemoBundle/Entity/AcmeEntity.php use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Constraints\NotBlank; diff --git a/cookbook/web_services/php_soap_extension.rst b/cookbook/web_services/php_soap_extension.rst index 3733cc3e64c..14b5afc8106 100644 --- a/cookbook/web_services/php_soap_extension.rst +++ b/cookbook/web_services/php_soap_extension.rst @@ -12,8 +12,8 @@ create one from scratch or use a 3rd party generator. .. note:: There are several SOAP server implementations available for use with - PHP. `Zend SOAP`_ and `NuSOAP`_ are two examples. Although we use - the PHP SOAP extension in our examples, the general idea should still + PHP. `Zend SOAP`_ and `NuSOAP`_ are two examples. Although the PHP SOAP + extension is used in these examples, the general idea should still be applicable to other implementations. SOAP works by exposing the methods of a PHP object to an external entity @@ -36,7 +36,7 @@ In this case, the SOAP service will allow the client to call a method called public function hello($name) { - + $message = \Swift_Message::newInstance() ->setTo('me@example.com') ->setSubject('Hello Service') @@ -51,7 +51,7 @@ In this case, the SOAP service will allow the client to call a method called Next, you can train Symfony to be able to create an instance of this class. Since the class sends an e-mail, it's been designed to accept a ``Swift_Mailer`` -instance. Using the Service Container, we can configure Symfony to construct +instance. Using the Service Container, you can configure Symfony to construct a ``HelloService`` object properly: .. configuration-block:: @@ -80,7 +80,7 @@ WSDL document can be retrieved via ``/soap?wsdl``. .. code-block:: php namespace Acme\SoapBundle\Controller; - + use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; @@ -90,14 +90,14 @@ WSDL document can be retrieved via ``/soap?wsdl``. { $server = new \SoapServer('/path/to/hello.wsdl'); $server->setObject($this->get('hello_service')); - + $response = new Response(); $response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1'); - + ob_start(); $server->handle(); $response->setContent(ob_get_clean()); - + return $response; } } @@ -117,7 +117,7 @@ assumes that the ``indexAction`` in the controller above is accessible via the route ``/soap``:: $client = new \Soapclient('http://example.com/app.php/soap?wsdl', true); - + $result = $client->call('hello', array('name' => 'Scott')); An example WSDL is below. @@ -125,14 +125,14 @@ An example WSDL is below. .. code-block:: xml - @@ -158,11 +158,11 @@ An example WSDL is below. - - diff --git a/cookbook/workflow/_vendor_deps.rst.inc b/cookbook/workflow/_vendor_deps.rst.inc index 865076ccc68..c9f4db6e365 100644 --- a/cookbook/workflow/_vendor_deps.rst.inc +++ b/cookbook/workflow/_vendor_deps.rst.inc @@ -23,7 +23,7 @@ It's important to realize that these vendor libraries are *not* actually part of *your* repository. Instead, they're simply un-tracked files that are downloaded into the ``vendor/`` directory by the ``bin/vendors`` script. But since all the information needed to download these files is saved in ``deps`` and ``deps.lock`` -(which *are* stored) in our repository), any other developer can use our +(which *are* stored) in the repository), any other developer can use the project, run ``php bin/vendors install``, and download the exact same set of vendor libraries. This means that you're controlling exactly what each vendor library looks like, without needing to actually commit them to *your* @@ -65,7 +65,7 @@ or upgraded. You can set that directly to the ``deps`` file : version=the-awesome-version * The ``git`` option sets the URL of the library. It can use various protocols, - like ``http://`` as well as ``git://``. + like ``http://`` as well as ``git://``. * The ``target`` option specifies where the repository will live : plain Symfony bundles should go under the ``vendor/bundles/Acme`` directory, other third-party @@ -80,11 +80,11 @@ Updating workflow ~~~~~~~~~~~~~~~~~ When you execute the ``php bin/vendors install``, for every library, the script first -checks if the install directory exists. +checks if the install directory exists. -If it does not (and ONLY if it does not), it runs a ``git clone``. +If it does not (and ONLY if it does not), it runs a ``git clone``. -Then, it does a ``git fetch origin`` and a ``git reset --hard the-awesome-version``. +Then, it does a ``git fetch origin`` and a ``git reset --hard the-awesome-version``. This means that the repository will only be cloned once. If you want to perform any change of the git remote, you MUST delete the entire target directory, not only its content. diff --git a/cookbook/workflow/new_project_svn.rst b/cookbook/workflow/new_project_svn.rst index c5ea0115c96..e3aeed94a63 100644 --- a/cookbook/workflow/new_project_svn.rst +++ b/cookbook/workflow/new_project_svn.rst @@ -25,7 +25,7 @@ would do with `git`_. The Subversion Repository ------------------------- -For this article we will suppose that your repository layout follows the +For this article it's assumed that your repository layout follows the widespread standard structure: .. code-block:: text @@ -69,7 +69,7 @@ To get started, you'll need to download Symfony2 and get the basic Subversion se subversion repository. Some files (like the cache) are generated and others (like the database configuration) are meant to be customized on each machine. This makes use of the ``svn:ignore`` property, so that - we can ignore specific files. + specific files can be ignored. .. code-block:: bash