Skip to content

Commit

Permalink
Document new ToolEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
wmouwen committed Mar 18, 2024
1 parent f1a6a6a commit 7fc5f68
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions docs/en/reference/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,8 @@ postGenerateSchema
~~~~~~~~~~~~~~~~~~

This event is fired after the schema instance was successfully built and before SQL queries are generated from the
schema information of ``Doctrine\DBAL\Schema\Schema``. It allows to access the full object representation of the database schema
and the EntityManager.
schema information of ``Doctrine\DBAL\Schema\Schema``. It allows to access the full object representation of the schema
and the EntityManager as mapped by the metadata attributes.

.. code-block:: php
Expand All @@ -1025,6 +1025,32 @@ and the EntityManager.
}
}
postGenerateComparisonSchema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This event is fired after the schema instance was successfully built and before SQL queries are generated from the
schema information of ``Doctrine\DBAL\Schema\Schema``. It allows to access the full object representation of the schema
as it is introspected from the database platform.

.. code-block:: php
<?php
use Doctrine\ORM\Tools\ToolEvents;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
$test = new TestEventListener();
$evm = $em->getEventManager();
$evm->addEventListener(ToolEvents::postGenerateComparisonSchema, $test);
class TestEventListener
{
public function postGenerateComparisonSchema(GenerateSchemaEventArgs $eventArgs)
{
$schema = $eventArgs->getSchema();
$em = $eventArgs->getEntityManager();
}
}
.. _PrePersistEventArgs: https://github.com/doctrine/orm/blob/HEAD/src/Event/PrePersistEventArgs.php
.. _PreRemoveEventArgs: https://github.com/doctrine/orm/blob/HEAD/src/Event/PreRemoveEventArgs.php
.. _PreUpdateEventArgs: https://github.com/doctrine/orm/blob/HEAD/src/Event/PreUpdateEventArgs.php
Expand Down

0 comments on commit 7fc5f68

Please sign in to comment.