Skip to content

Commit 909088f

Browse files
authored
Merge pull request #244 from j4nr6n/patch-1
Remove container aware migrations documentation
2 parents c7373c2 + a6ce2c2 commit 909088f

File tree

1 file changed

+0
-61
lines changed

1 file changed

+0
-61
lines changed

Resources/doc/index.rst

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -329,67 +329,6 @@ If you don't want to use this workflow and instead create your schema via
329329
330330
Otherwise Doctrine will try to run all migrations, which probably will not work.
331331
332-
Container Aware Migrations
333-
--------------------------
334-
335-
In some cases you might need access to the container to ensure the proper update of
336-
your data structure. This could be necessary to update relations with some specific
337-
logic or to create new entities.
338-
339-
Therefore you can just implement the ContainerAwareInterface with its needed methods
340-
to get full access to the container or ContainerAwareTrait if you use Symfony >= 2.4.
341-
342-
.. code-block:: php
343-
344-
// ...
345-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
346-
use Symfony\Component\DependencyInjection\ContainerInterface;
347-
348-
class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface
349-
{
350-
private $container;
351-
352-
public function setContainer(ContainerInterface $container = null)
353-
{
354-
$this->container = $container;
355-
}
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-
369-
With the trait
370-
371-
.. code-block:: php
372-
373-
// ...
374-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
375-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
376-
377-
class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface
378-
{
379-
use ContainerAwareTrait;
380-
381-
public function up(Schema $schema)
382-
{
383-
// ... migration content
384-
}
385-
386-
public function postUp(Schema $schema)
387-
{
388-
$converter = $this->container->get('my_service.convert_data_to');
389-
// ... convert the data from markdown to html for instance
390-
}
391-
}
392-
393332
Manual Tables
394333
-------------
395334

0 commit comments

Comments
 (0)