/**
  * 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
  * @return void
  * @see typo3.flow3:doctrine:validate
  */
 public function entityStatusCommand($dumpMappingData = FALSE)
 {
     $info = $this->doctrineService->getEntityStatus();
     if ($info === array()) {
         $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:', array(count($info)));
         foreach ($info as $entityClassName => $entityStatus) {
             if ($entityStatus instanceof \Doctrine\Common\Persistence\Mapping\ClassMetadata) {
                 $this->outputLine('[OK]   %s', array($entityClassName));
                 if ($dumpMappingData) {
                     \TYPO3\FLOW3\Error\Debugger::clearState();
                     $this->outputLine(\TYPO3\FLOW3\Error\Debugger::renderDump($entityStatus, 0, TRUE, TRUE));
                 }
             } else {
                 $this->outputLine('[FAIL] %s', array($entityClassName));
                 $this->outputLine($entityStatus);
                 $this->outputLine();
             }
         }
     }
 }
Exemple #2
0
/**
 * A var_dump function optimized for FLOW3's object structures
 *
 * @param mixed $variable The variable to display a dump of
 * @param string $title optional custom title for the debug output
 * @param boolean $return if TRUE, the dump is returned for displaying it embedded in custom HTML. If FALSE (default), the variable dump is directly displayed.
 * @param boolean $plaintext If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format. If not specified, the mode is guessed from FLOW3_SAPITYPE
 * @return void|string if $return is TRUE, the variable dump is returned. By default, the dump is directly displayed, and nothing is returned.
 * @api
 */
function var_dump($variable, $title = NULL, $return = FALSE, $plaintext = NULL)
{
    if ($plaintext === NULL) {
        $plaintext = FLOW3_SAPITYPE === 'CLI';
        $ansiColors = $plaintext && DIRECTORY_SEPARATOR === '/';
    } else {
        $ansiColors = FALSE;
    }
    if ($title === NULL) {
        $title = 'FLOW3 Variable Dump';
    }
    if ($ansiColors) {
        $title = "" . $title . "";
    }
    \TYPO3\FLOW3\Error\Debugger::clearState();
    if (!$plaintext && \TYPO3\FLOW3\Error\Debugger::$stylesheetEchoed === FALSE) {
        echo '<link rel="stylesheet" type="text/css" href="/_Resources/Static/Packages/TYPO3.FLOW3/Error/Debugger.css" />';
        \TYPO3\FLOW3\Error\Debugger::$stylesheetEchoed = TRUE;
    }
    if ($plaintext) {
        $output = $title . chr(10) . \TYPO3\FLOW3\Error\Debugger::renderDump($variable, 0, TRUE, $ansiColors) . chr(10) . chr(10);
    } else {
        $output = '
			<div class="FLOW3-Error-Debugger-VarDump ' . ($return ? 'FLOW3-Error-Debugger-VarDump-Inline' : 'FLOW3-Error-Debugger-VarDump-Floating') . '">
				<div class="FLOW3-Error-Debugger-VarDump-Top">
					' . htmlspecialchars($title) . '
				</div>
				<div class="FLOW3-Error-Debugger-VarDump-Center">
					<pre dir="ltr">' . \TYPO3\FLOW3\Error\Debugger::renderDump($variable, 0, FALSE, FALSE) . '</pre>
				</div>
			</div>
		';
    }
    if ($return === TRUE) {
        return $output;
    } else {
        echo $output;
    }
}