Bug Report
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);
}
Bug Report
Summary
\Doctrine\ORM\Tools\Console\Command\MappingDescribeCommand::formatEntityListenerscrashes withget_class(): Argument #1 ($object) must be of type object, array givenwhen 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
Suggested fix