-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report
| Q | A |
|---|---|
| Version | 3.6.2 |
Summary
\Doctrine\ORM\Tools\Console\Command\MappingDescribeCommand::formatEntityListeners crashes with get_class(): Argument #1 ($object) must be of type object, array given when the described entity has entity listeners registered.
Current behavior
Run orm:mapping:describe <YourEntity> when the entity has entity listeners and get the crash described above.
Expected behavior
Run orm:mapping:describe <YourEntity> when the entity has entity listeners and get a nicely formatted output including the entity listeners.
How to reproduce
- Create a new Symfony project, added doctrine-bundle/orm, added an entity and an entity listener.
- Run bin/console doctrine:mapping:describe
Suggested fix
/**
* Format the entity listeners
*
* @phpstan-param array<string, list<array{class: class-string, method: string}>> $entityListeners
*
* @return string[]
* @phpstan-return array{0: string, 1: string}
*/
private function formatEntityListeners(array $entityListeners): array
{
$listeners = [];
foreach ($entityListeners as $eventName => $eventListeners) {
foreach ($eventListeners as $listener) {
$listeners[] = sprintf('%s: %s::%s', $eventName, $listener['class'], $listener['method']);
}
}
return $this->formatField('Entity listeners', $listeners);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels