File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed
Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments