I have the following configuration
$isDevMode = \Config::get("DEBUG");
self::$config = Setup::createAnnotationMetadataConfiguration(array(APP_PATH.'models'), $isDevMode, APP_PATH.'proxies');
// naming strategy
$namingStrategy = new \DoctrineExtensions\CustomNamingStrategy();
self::$config->setNamingStrategy($namingStrategy);
// database configuration parameters
self::$conn = array(
'url' => \Config::get('DB_DSN')
);
self::$evm = new \Doctrine\Common\EventManager;
// Table Prefix
$tablePrefix = new \DoctrineExtensions\TablePrefix(\Config::get('TABLE_PREFIX'));
self::$evm->addEventListener(Events::loadClassMetadata, $tablePrefix);
self::$entityManager = EntityManager::create(self::$conn, self::$config, self::$evm);
From Doctrine 2 Documentation which I understand, this should be generate Proxy classes in APP_PATH.'proxies'
folder ( when $isDevMode
is true. This should happen automatically).
Unfortunately it doesn't automatically generated classes. I don't know what the reason. However I generated these classes manually by using the following command php vendor/bin/doctrine orm:generate-proxies
. Classes are generated and already exist in the folder. In order to try Proxy classes i wrote the following lines:
$qq = $this->repositoryPages
->createQueryBuilder('p')
->select('p.title')
->where('p.id = :id')
->setParameter('id', 6)
->getQuery()->getResult();
var_dump($qq);
Unfortunately for me this returns an associative array
array (size=1)
0 =>
array (size=1)
'title' => string 'Welcome' (length=7)
What is wrong and what I need to do to get the object ?