Wrong exception message when passing arguments to @preFlush #5116

Open
opened 2026-01-22 14:58:50 +01:00 by admin · 0 comments
Owner

Originally created by @muchar on GitHub (May 3, 2016).

When passing arguments to the preFlush function, the exception message says:

Argument 1 passed to Feedink\\ImportBundle\\Entity\\Import::preFlush() must be an instance of Doctrine\\ORM\\Event\\OnFlushEventArgs, instance of Doctrine\\ORM\\Event\\PreFlushEventArgs given, called in ...

The non-working function declaration looks like this:

public function preFlush(OnFlushEventArgs $eventArgs)
{
  ...
}

The working function declaration looks like this:

public function preFlush(PreFlushEventArgs $eventArgs)
{
   ...
}
Originally created by @muchar on GitHub (May 3, 2016). When passing arguments to the preFlush function, the exception message says: ``` php Argument 1 passed to Feedink\\ImportBundle\\Entity\\Import::preFlush() must be an instance of Doctrine\\ORM\\Event\\OnFlushEventArgs, instance of Doctrine\\ORM\\Event\\PreFlushEventArgs given, called in ... ``` The non-working function declaration looks like this: ``` php public function preFlush(OnFlushEventArgs $eventArgs) { ... } ``` The working function declaration looks like this: ``` php public function preFlush(PreFlushEventArgs $eventArgs) { ... } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5116