Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch '2.0' into 2.1

Conflicts:
	cookbook/testing/doctrine.rst
	cookbook/testing/profiling.rst
  • Loading branch information...
commit a03f06f7657a29fbfc8a049da1d92ab9e1681624 2 parents 760d20e + b1eb34a
@weaverryan weaverryan authored
View
2  book/translation.rst
@@ -994,7 +994,7 @@ steps:
.. _`i18n`: http://en.wikipedia.org/wiki/Internationalization_and_localization
.. _`L10n`: http://en.wikipedia.org/wiki/Internationalization_and_localization
.. _`strtr function`: http://www.php.net/manual/en/function.strtr.php
-.. _`ISO 31-11`: http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation
+.. _`ISO 31-11`: http://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
.. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions
.. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
.. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
View
34 cookbook/doctrine/file_uploads.rst
@@ -55,23 +55,29 @@ First, create a simple Doctrine Entity class to work with::
public function getAbsolutePath()
{
- return null === $this->path ? null : $this->getUploadRootDir().'/'.$this->path;
+ return null === $this->path
+ ? null
+ : $this->getUploadRootDir().'/'.$this->path;
}
public function getWebPath()
{
- return null === $this->path ? null : $this->getUploadDir().'/'.$this->path;
+ return null === $this->path
+ ? null
+ : $this->getUploadDir().'/'.$this->path;
}
protected function getUploadRootDir()
{
- // the absolute directory path where uploaded documents should be saved
+ // the absolute directory path where uploaded
+ // documents should be saved
return __DIR__.'/../../../../web/'.$this->getUploadDir();
}
protected function getUploadDir()
{
- // get rid of the __DIR__ so it doesn't screw when displaying uploaded doc/image in the view.
+ // get rid of the __DIR__ so it doesn't screw up
+ // when displaying uploaded doc/image in the view.
return 'uploads/documents';
}
}
@@ -213,8 +219,12 @@ object, which is what's returned after a ``file`` field is submitted::
// 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());
+ // move takes the target directory and then the
+ // target filename to move to
+ $this->file->move(
+ $this->getUploadRootDir(),
+ $this->file->getClientOriginalName()
+ );
// set the path property to the filename where you've saved the file
$this->path = $this->file->getClientOriginalName();
@@ -266,7 +276,8 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
{
if (null !== $this->file) {
// do whatever you want to generate a unique name
- $this->path = sha1(uniqid(mt_rand(), true)).'.'.$this->file->guessExtension();
+ $filename = sha1(uniqid(mt_rand(), true));
+ $this->path = $filename.'.'.$this->file->guessExtension();
}
}
@@ -373,7 +384,10 @@ property, instead of the actual filename::
// you must throw an exception here if the file cannot be moved
// so that the entity is not persisted to the database
// which the UploadedFile move() method does
- $this->file->move($this->getUploadRootDir(), $this->id.'.'.$this->file->guessExtension());
+ $this->file->move(
+ $this->getUploadRootDir(),
+ $this->id.'.'.$this->file->guessExtension()
+ );
unset($this->file);
}
@@ -398,7 +412,9 @@ property, instead of the actual filename::
public function getAbsolutePath()
{
- return null === $this->path ? null : $this->getUploadRootDir().'/'.$this->id.'.'.$this->path;
+ return null === $this->path
+ ? null
+ : $this->getUploadRootDir().'/'.$this->id.'.'.$this->path;
}
}
View
19 cookbook/doctrine/multiple_entity_managers.rst
@@ -64,7 +64,7 @@ two connections, one for each entity manager.
.. note::
- When working with multiple connections and entity managers, you should be
+ When working with multiple connections and entity managers, you should be
explicit about which configuration you want. If you *do* omit the name of
the connection or entity manager, the default (i.e. ``default``) is used.
@@ -98,7 +98,7 @@ the default entity manager (i.e. ``default``) is returned::
// both return the "default" em
$em = $this->get('doctrine')->getManager();
$em = $this->get('doctrine')->getManager('default');
-
+
$customerEm = $this->get('doctrine')->getManager('customer');
}
}
@@ -115,17 +115,20 @@ The same applies to repository call::
{
// Retrieves a repository managed by the "default" em
$products = $this->get('doctrine')
- ->getRepository('AcmeStoreBundle:Product')
- ->findAll();
+ ->getRepository('AcmeStoreBundle:Product')
+ ->findAll()
+ ;
// Explicit way to deal with the "default" em
$products = $this->get('doctrine')
- ->getRepository('AcmeStoreBundle:Product', 'default')
- ->findAll();
+ ->getRepository('AcmeStoreBundle:Product', 'default')
+ ->findAll()
+ ;
// Retrieves a repository managed by the "customer" em
$customers = $this->get('doctrine')
- ->getRepository('AcmeCustomerBundle:Customer', 'customer')
- ->findAll();
+ ->getRepository('AcmeCustomerBundle:Customer', 'customer')
+ ->findAll()
+ ;
}
}
View
23 cookbook/doctrine/registration_form.rst
@@ -194,7 +194,11 @@ Next, create the form for this ``Registration`` model::
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('user', new UserType());
- $builder->add('terms', 'checkbox', array('property_path' => 'termsAccepted'));
+ $builder->add(
+ 'terms',
+ 'checkbox',
+ array('property_path' => 'termsAccepted')
+ );
}
public function getName()
@@ -227,9 +231,15 @@ controller for displaying the registration form::
{
public function registerAction()
{
- $form = $this->createForm(new RegistrationType(), new Registration());
-
- return $this->render('AcmeAccountBundle:Account:register.html.twig', array('form' => $form->createView()));
+ $form = $this->createForm(
+ new RegistrationType(),
+ new Registration()
+ );
+
+ return $this->render(
+ 'AcmeAccountBundle:Account:register.html.twig',
+ array('form' => $form->createView())
+ );
}
}
@@ -264,7 +274,10 @@ the validation and saves the data into the database::
return $this->redirect(...);
}
- return $this->render('AcmeAccountBundle:Account:register.html.twig', array('form' => $form->createView()));
+ return $this->render(
+ 'AcmeAccountBundle:Account:register.html.twig',
+ array('form' => $form->createView())
+ );
}
That's it! Your form now validates, and allows you to save the ``User``
View
13 cookbook/email/dev_environment.rst
@@ -96,7 +96,12 @@ Now, suppose you're sending an email to ``recipient@example.com``.
->setSubject('Hello Email')
->setFrom('send@example.com')
->setTo('recipient@example.com')
- ->setBody($this->renderView('HelloBundle:Hello:email.txt.twig', array('name' => $name)))
+ ->setBody(
+ $this->renderView(
+ 'HelloBundle:Hello:email.txt.twig',
+ array('name' => $name)
+ )
+ )
;
$this->get('mailer')->send($message);
@@ -150,10 +155,10 @@ you to open the report with details of the sent emails.
<!-- app/config/config_dev.xml -->
- <!--
+ <!--
xmlns:webprofiler="http://symfony.com/schema/dic/webprofiler"
- xsi:schemaLocation="http://symfony.com/schema/dic/webprofiler
- http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd">
+ xsi:schemaLocation="http://symfony.com/schema/dic/webprofiler
+ http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd">
-->
<webprofiler:config
View
7 cookbook/email/email.rst
@@ -106,7 +106,12 @@ an email is pretty straightforward::
->setSubject('Hello Email')
->setFrom('send@example.com')
->setTo('recipient@example.com')
- ->setBody($this->renderView('HelloBundle:Hello:email.txt.twig', array('name' => $name)))
+ ->setBody(
+ $this->renderView(
+ 'HelloBundle:Hello:email.txt.twig',
+ array('name' => $name)
+ )
+ )
;
$this->get('mailer')->send($message);
View
4 cookbook/form/form_collections.rst
@@ -607,7 +607,9 @@ the relationship between the removed ``Tag`` and ``Task`` object.
$originalTags = array();
// Create an array of the current Tag objects in the database
- foreach ($task->getTags() as $tag) $originalTags[] = $tag;
+ foreach ($task->getTags() as $tag) {
+ $originalTags[] = $tag;
+ }
$editForm = $this->createForm(new TaskType(), $task);
View
5 cookbook/testing/doctrine.rst
@@ -39,7 +39,10 @@ which makes all of this quite easy::
{
static::$kernel = static::createKernel();
static::$kernel->boot();
- $this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
+ $this->em = static::$kernel->getContainer()
+ ->get('doctrine')
+ ->getManager()
+ ;
}
public function testSearchByCategoryName()
View
15 cookbook/testing/profiling.rst
@@ -27,10 +27,16 @@ environment)::
// Check that the profiler is enabled
if ($profile = $client->getProfile()) {
// check the number of requests
- $this->assertLessThan(10, $profile->getCollector('db')->getQueryCount());
+ $this->assertLessThan(
+ 10,
+ $profile->getCollector('db')->getQueryCount()
+ );
// check the time spent in the framework
- $this->assertLessThan(500, $profile->getCollector('time')->getTotalTime());
+ $this->assertLessThan(
+ 500,
+ $profile->getCollector('time')->getTotalTime()
+ );
}
}
}
@@ -42,7 +48,10 @@ finish. It's easy to achieve if you embed the token in the error message::
$this->assertLessThan(
30,
$profile->get('db')->getQueryCount(),
- sprintf('Checks that query count is less than 30 (token %s)', $profile->getToken())
+ sprintf(
+ 'Checks that query count is less than 30 (token %s)',
+ $profile->getToken()
+ )
);
.. caution::

0 comments on commit a03f06f

Please sign in to comment.
Something went wrong with that request. Please try again.