8000 Update event_listeners_subscribers.rst · symfony/symfony-docs@d4e78c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4e78c4

Browse files
hamzahanafi11weaverryan
authored andcommitted
Update event_listeners_subscribers.rst
By using $args->getEntity() you can have access to the generated id (primary key) of the object $args->getObject() returns the object before executing flush() method
1 parent 0df2f8a commit d4e78c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doctrine/event_listeners_subscribers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ a ``postPersist()`` method, which will be called when the event is dispatched::
131131
{
132132
public function postPersist(LifecycleEventArgs $args)
133133
{
134-
$object = $args->getObject();
134+
$object = $args->getEntity();
135135

136136
// only act on some "Product" entity
137137
if (!$object instanceof Product) {

0 commit comments

Comments
 (0)
0