Created
April 29, 2014 07:22
-
-
Save tournasdim/11392844 to your computer and use it in GitHub Desktop.
Doctrine 2 bootstrap file (defining explicitly the AnnotationDriver) Entities should now import the Mapper Classes : use Doctrine\ORM\Mapping as ORM ;
/** * @Orm\Entity * @Orm\Table(name="blog") */
class Blog
{ /** * @Orm\Id * @Orm\Column(type="integer") * @Orm\GeneratedValue(strategy="AUTO") */ protected $id;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\ORM\Tools\Setup; | |
use Doctrine\ORM\EntityManager; | |
use Doctrine\ORM\Mapping\Driver\AnnotationDriver ; | |
use Doctrine\Common\Annotations\AnnotationReader ; | |
require_once __DIR__.'/../vendor/autoload.php'; | |
require_once __DIR__.'/../config/config.php'; | |
$entitiesPath = array(__DIR__.'/Blog'); | |
$config = Setup::createAnnotationMetadataConfiguration($entitiesPath, $isDevMode); | |
$driver = new AnnotationDriver(new AnnotationReader(),array(__DIR__ . '/Blog')); | |
$config->setMetadataDriverImpl($driver); | |
$entityManager = EntityManager::create($dbParams, $config); | |
//var_dump($config) ; // Doctrine\ORM\Configuration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment