草庐IT

Doctrine_Query

全部标签

php - 试图从命名空间 "Month"加载类 "DoctrineExtensions\Query\Mysql"。您是否忘记了另一个命名空间的 "use"语句

我收到错误Attemptedtoloadclass"Month"fromnamespace"DoctrineExtensions\Query\Mysql"。当我尝试创建一个按年和月获取数据的查询时,你是否忘记了另一个命名空间的“使用”语句在我的仓库中publicfunctiongetCongePris($mois,$annee,$matricule){$emConfig=$this->_em->getConfiguration();$emConfig->addCustomDatetimeFunction('YEAR','DoctrineExtensions\Query\Mysql\Ye

php - Doctrine2 错误 "Expected known function, got ' COUNT'"when in order by clause

我正在使用doctrine2我尝试根据售出的门票数量获取“事件”的数量$manager=$this->getDoctrine()->getManager();$builder=$manager->createQueryBuilder();return$builder->select('e')->from('AppBundle:Event','e')->leftJoin('e.tickets','t')->orderBy('COUNT(t)')->groupBy('e.id')->setMaxResults(10)->getQuery()->getResult();这会产生错误[Synt

php - 拉维尔 5 : Replace string in query results (Eloquent ORM)

是否可以返回表中的所有列,但如果字符串(值)包含特定单词,则删除该单词?比如我有这样一张表:-------------------------------------------------|id|article_desc|article_link|active||----|------------------|----------------|--------||1|Hello,world!|http://test.co|0||2|ReplaceWordTest|http://null.org|1|-------------------------------------------

php - codeception : Setting the "doctrine" pre-defined service is deprecated since Symfony 3. 3 并且 Symfony 4.0 将不再支持

我的项目是一个带有DoctrineORM的Symfony3.3.9项目。我将codeception2.3.6与模块Doctrine2一起使用,我关注这篇文章:http://codeception.com/docs/modules/Doctrine2我的codeception配置是:#tests/functional.suite.ymlactor:FunctionalTestermodules:enabled:-\Helper\Functional-PhpBrowser:url:http://localhost-Symfony-Doctrine2:depends:Symfonyclean

php - Symfony 和 Doctrine 元数据缓存

我正在尝试优化我的Symfony应用程序性能,并且我关注了这些帖子:https://symfony.com/doc/2.8/performance.htmlSymfony2SlowInitializationTime我“担心”这些行:doctrine:orm:entity_managers:default:metadata_cache_driver:apcquery_cache_driver:apcresult_cache_driver:apc使用它们是否安全,或者我必须在部署后小心处理它们?我正在使用phpapp/consolecache:clear--env=prod--no-de

php - 如何在 Symfony 4 中不使用 DoctrineBundle 将 DBAL Doctrine 连接注册为服务

我正在尝试仅将DoctrineDBALConnection组件注册为Symfony4中的服务。我不需要symfony提供的完整DoctrineBundle,只需要提供基本数据库抽象级别的部分。现在我一直在研究如何将composer下载的原始库作为服务来实现。Connection类应该是这样创建的,来自官方文档:'mydb','user'=>'user','password'=>'secret','host'=>'localhost','driver'=>'pdo_mysql',);$conn=\Doctrine\DBAL\DriverManager::getConnection($co

php - Symfony 4 Doctrine 无法从控制台工作 [2002] 没有这样的文件或目录

我正在使用symfony4,在运行doctrine控制台命令时出现此错误:InAbstractMySQLDriver.phpline108:Anexceptionoccurredindriver:SQLSTATE[HY000][2002]Nosuchfileordirectory我认为这是因为连接有问题,但是当我运行应用程序时它可以毫无错误地访问数据库,所以我无法想象连接有什么问题。我能够通过手动创建数据库并使用继续工作phpbin/consoledoctrine:schema:create--dump-sql但这确实是不需要的,因为稍后当需要更新架构时,所有数据都将丢失,因为我需要重

php - Doctrine - 使用列值作为数组索引

我有这个问题:$qb=$this->_em->createQueryBuilder();$qb->select('f.name','f.id')->from('Bundle:F','f','f.id');return$qb->getQuery()->getResult();返回结果如下:array:438[▼214=>array:2[▼"name"=>"xxx""id"=>214]215=>array:2[▼"name"=>"yyy""id"=>215]...但我不想要子数组并希望结果像这样返回:array:438[▼214=>"xxx"215=>"yyy"...即id作为键,name

php - 在 Zend Framework 1.10.x 中使用 Doctrine 2

我如何开始使用Doctrine2+ZF?任何教程或资源?旁注,我听说ZF2将使用Doctrine作为其模型,是吗? 最佳答案 使用ZF和Doctrine2的好处在于集成它们几乎不需要做任何事情。本质上,您只需要访问在应用程序引导期间设置的Doctrine2的EntityManager实例,并确保Doctrinenamespace已加载到您的index.php(你需要为此使用Doctrine的ClassLoader,Zend_Loader还不支持命名空间)。您可以在Bootstrap中手动实例化您的EntityManager,或者更容

php - 在 Windows 中轻松使用 PHP doctrine CLI

在Windows中,要从任何目录使用doctrineCLI,我需要使用类似的东西phpD:\full\path\to\doctrine\bin\doctrine.php--variableshere无论如何我可以缩短它,使其变成类似的东西phpdoctrine.php--variableshere甚至doctrine--variableshere 最佳答案 试试doskeydoctrine=phpD:\full\path\to\doctrine\bin\doctrine.php$*那么你应该可以doctrine--variables