Skip to content

Commit 9cf3db6

Browse files
committed
Make 2 examples for clarity
1 parent e8b7a0e commit 9cf3db6

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

Resources/doc/index.rst

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,9 @@ to get full access to the container or ContainerAwareTrait if you use Symfony >=
319319
// ...
320320
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
321321
use Symfony\Component\DependencyInjection\ContainerInterface;
322-
// Symfony >= 2.4
323-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
324322
325323
class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface
326324
{
327-
// Symfony >= 2.4
328-
use ContainerAwareTrait;
329-
330-
// Symfony 2.3
331325
private $container;
332326
333327
public function setContainer(ContainerInterface $container = null)
@@ -347,6 +341,31 @@ to get full access to the container or ContainerAwareTrait if you use Symfony >=
347341
}
348342
}
349343
344+
With the trait
345+
346+
.. code-block:: php
347+
348+
// ...
349+
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
350+
use Symfony\Component\DependencyInjection\ContainerInterface;
351+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
352+
353+
class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface
354+
{
355+
use ContainerAwareTrait;
356+
357+
public function up(Schema $schema)
358+
{
359+
// ... migration content
360+
}
361+
362+
public function postUp(Schema $schema)
363+
{
364+
$converter = $this->container->get('my_service.convert_data_to');
365+
// ... convert the data from markdown to html for instance
366+
}
367+
}
368+
350369
Manual Tables
351370
-------------
352371

0 commit comments

Comments
 (0)