/**
* Show the current status of entities and mappings
*
* Shows basic information about which entities exist and possibly if their
* mapping information contains errors or not.
*
* To run a full validation, use the validate command.
*
* @param boolean $dumpMappingData If set, the mapping data will be output
* @param string $entityClassName If given, the mapping data for just this class will be output
* @return void
* @see neos.flow:doctrine:validate
*/
public function entityStatusCommand($dumpMappingData = false, $entityClassName = null)
{
$info = $this->doctrineService->getEntityStatus();
if ($info === []) {
$this->output('You do not have any mapped Doctrine ORM entities according to the current configuration. ');
$this->outputLine('If you have entities or mapping files you should check your mapping configuration for errors.');
} else {
$this->outputLine('Found %d mapped entities:', [count($info)]);
$this->outputLine();
if ($entityClassName === null) {
foreach ($info as $entityClassName => $entityStatus) {
if ($entityStatus instanceof ClassMetadata) {
$this->outputLine('<success>[OK]</success> %s', [$entityClassName]);
if ($dumpMappingData) {
Debugger::clearState();
$this->outputLine(Debugger::renderDump($entityStatus, 0, true, true));
}
} else {
$this->outputLine('<error>[FAIL]</error> %s', [$entityClassName]);
$this->outputLine($entityStatus);
$this->outputLine();
}
}
} else {
if (array_key_exists($entityClassName, $info) && $info[$entityClassName] instanceof ClassMetadata) {
$entityStatus = $info[$entityClassName];
$this->outputLine('<success>[OK]</success> %s', [$entityClassName]);
if ($dumpMappingData) {
Debugger::clearState();
$this->outputLine(Debugger::renderDump($entityStatus, 0, true, true));
}
} else {
$this->outputLine('<info>[FAIL]</info> %s', [$entityClassName]);
$this->outputLine('Class not found.');
$this->outputLine();
}
}
}
}