php - Doctrine not finding data on Google App Engine? -


when simple query, finding users, returns empty array. $users = $em->getrepository('myapp\\model\\entity\\user')->findall();

however, when connect database manually, using pdo, finds data. using arraycache method, make sure has nothing gae not having filesystem. gae docs can use sys_get_temp_dir(), don't think it's proxies. i'm @ loss why doctrine returning nothing , not throwing errors well.

here bootstrap file app:

<?php  $basedir = dirname(dirname(__file__));  define('timezone_offset', \myapp\library\date::getmytimezoneoffset());  use doctrine\common\annotations\annotationreader; use doctrine\common\annotations\annotationregistry;  // globally used cache driver, in production use apc or memcached $cache = new doctrine\common\cache\arraycache; // standard annotation reader $annotationreader = new annotationreader; annotationreader::addglobalignoredname('dummy'); annotationregistry::registerfile(__dir__ . "/doctrine/orm/lib/doctrine/orm/mapping/driver/doctrineannotations.php"); annotationregistry::registerfile(__dir__ . "/gedmo/timestampable/mapping/driver/annotation.php"); annotationregistry::registerautoloadnamespace("\\myapp\\model\\entity", $basedir); $cachedannotationreader = new doctrine\common\annotations\cachedreader(     $annotationreader, // use reader     $cache, // , cache driver     $debug = local ); // create driver chain metadata reading $driverchain = new doctrine\orm\mapping\driver\driverchain(); // load superclass metadata mapping only, driver chain // registers gedmo annotations.note: can personalize gedmo\doctrineextensions::registerabstractmappingintodriverchainorm(     $driverchain, // our metadata driver chain, hook     $cachedannotationreader // our cached annotation reader );  // want register our application entities, // need metadata driver used entity namespace $annotationdriver = new doctrine\orm\mapping\driver\annotationdriver(     $cachedannotationreader, // our cached annotation reader     array(entity_path) // paths in ); // note: driver application entity can different, yaml, xml or whatever // register annotation driver our application entity namespace $driverchain->adddriver($annotationdriver, 'myapp\\model\\entity');  // general orm configuration $config = new doctrine\orm\configuration; $config->setproxydir(sys_get_temp_dir()); $config->setproxynamespace('proxy'); $config->setautogenerateproxyclasses(doctrine\common\proxy\abstractproxyfactory::autogenerate_file_not_exists); // can based on production config. // register metadata driver $config->setmetadatadriverimpl($driverchain); // use our initialized cache driver $config->setmetadatacacheimpl($cache); $config->setquerycacheimpl($cache);  // create event manager , hook preferred extension listeners $evm = new doctrine\common\eventmanager(); // gedmo extension listeners, remove not used  // timestampable $timestampablelistener = new gedmo\timestampable\timestampablelistener; $timestampablelistener->setannotationreader($cachedannotationreader); $evm->addeventsubscriber($timestampablelistener);  // mysql set names utf-8 if required $evm->addeventsubscriber(new doctrine\dbal\event\listeners\mysqlsessioninit());  $dbparams = array(     'driver' => 'pdo_mysql',     'user' => db_user,     'password' => db_password,     'dbname' => db_name,     'host' => db_host,     'port' => db_port,     'unix_socket' => db_unix_socket );  // finally, create entity manager $em = doctrine\orm\entitymanager::create($dbparams, $config, $evm); 

update

just clarity:

this returns empty array:

$users = $em->getrepository('myapp\\model\\entity\\user')->findall(); \doctrine\common\util\debug::dump($users); 

and returns array users in it. confused.

$pdo = $em->getconnection(); $users = $pdo->query('select * user'); var_dump($users->fetchall()); 

my issue didn't create company in database , user entity requires company, doctrine used inner join , thus, no users. ugh.

update

see question: why doctrine2 inner join findall()?


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -