Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Component/s: Documentation
-
Labels:None
-
Environment:Doctrine Version 2.0.0BETA3
Description
From this page: http://www.doctrine-project.org/projects/orm/2.0/docs/cookbook/getting-started-xml-edition/en
The contents of the sample cli-config.php file are:
<?php
$cliConfig = new Doctrine\Common\Cli\Configuration();
$cliConfig->setAttribute('em', $entityManager);
This generates an error: Fatal error: require(): Failed opening required 'Doctrine\Common\Cli\Configuration.php' as the class referenced does not exist.
Futhermore, having examined the $entityManager variable, it is not set and evaluates to NULL.
After trying to get this work for a while, it seems you need to put something like this in cli-config.php (where index.php is the "obtaining the entity manager" snippet further up the page):
<?php
include "index.php";
$helpers = array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($entityManager->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager)
);
$helperSet = new \Symfony\Components\Console\Helper\HelperSet($helpers);