diff --git a/Resources/doc/index.rst b/Resources/doc/index.rst index 9d56cbd..1a34299 100644 --- a/Resources/doc/index.rst +++ b/Resources/doc/index.rst @@ -329,67 +329,6 @@ If you don't want to use this workflow and instead create your schema via Otherwise Doctrine will try to run all migrations, which probably will not work. -Container Aware Migrations --------------------------- - -In some cases you might need access to the container to ensure the proper update of -your data structure. This could be necessary to update relations with some specific -logic or to create new entities. - -Therefore you can just implement the ContainerAwareInterface with its needed methods -to get full access to the container or ContainerAwareTrait if you use Symfony >= 2.4. - -.. code-block:: php - - // ... - use Symfony\Component\DependencyInjection\ContainerAwareInterface; - use Symfony\Component\DependencyInjection\ContainerInterface; - - class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface - { - private $container; - - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - - public function up(Schema $schema) - { - // ... migration content - } - - public function postUp(Schema $schema) - { - $converter = $this->container->get('my_service.convert_data_to'); - // ... convert the data from markdown to html for instance - } - } - -With the trait - -.. code-block:: php - - // ... - use Symfony\Component\DependencyInjection\ContainerAwareInterface; - use Symfony\Component\DependencyInjection\ContainerAwareTrait; - - class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface - { - use ContainerAwareTrait; - - public function up(Schema $schema) - { - // ... migration content - } - - public function postUp(Schema $schema) - { - $converter = $this->container->get('my_service.convert_data_to'); - // ... convert the data from markdown to html for instance - } - } - Manual Tables -------------