mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1295: Sandbox Sample Code which shall go into cli-config.php and index.php for EntityManager working with yaml is wrong #1625
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jul 25, 2011).
Originally assigned to: @guilhermeblanco on GitHub.
Jira issue originally created by user szsoftware:
In http://www.doctrine-project.org/docs/orm/2.1/en/tutorials/getting-started-xml-edition.html
in Section: Obtaining the EntityManager
the Code:
//$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(DIR."/config/mappings/xml");
$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(DIR."/config/mappings/yml");
//$driverImpl = $config->newDefaultAnnotationDriver(DIR."/entities");
produces:
PHP Fatal error: Class 'Sandbox\Doctrine\ORM\Mapping\Driver\XmlDriver' not found in ..
Should be corrected to:
$driverImpl = new \Doctrine\ORM\Mapping\Driver\XmlDriver(DIR."/config/mappings/yml");
produces:
PHP Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'No mapping file found named 'Entities.User.dcm.xml' ..
Should be corrected to:
$driverImpl = new \Doctrine\ORM\Mapping\Driver\YamlDriver(DIR."/config/mappings/yml");
and finally, following the xml yaml Entities folder structure in the sandbox, should be corrected to:
$driverImpl = new \Doctrine\ORM\Mapping\Driver\YamlDriver(DIR."/yaml");
With this configuration I was able to create Entities from yaml through these commands:
doctrine orm:generate-entities ./
doctrine orm:schema-tool:create
@doctrinebot commented on GitHub (Dec 9, 2011):
Comment created by @guilhermeblanco:
This issue was already solved in 2.2....
The tutorial code changed due to the new support introduced in 2.2, so I'm marking as fixed and assigning to this middle point version.
Cheers,
@doctrinebot commented on GitHub (Dec 9, 2011):
Issue was closed with resolution "Fixed"