草庐IT

doctrine-module

全部标签

php - 当改变位置超过 1 时,Doctrine Extensions Sortable 无法正常工作

我正在使用Symfony3.1+DoctrineGEDMO扩展(通过StofDoctrineExtensionsBundle)。我已将我的实体设置为具有可排序行为:position;}/***@parammixed$position*/publicfunctionsetPosition($position){$this->position=$position;}/***@returnmixed*/publicfunctiongetTitle(){return$this->title;}/***@parammixed$title*/publicfunctionsetTitle($titl

php - Zend Framework 1.9 和 Doctrine 集成

我正在尝试设置ZendFramework和Doctrine。之前有关于ZF1.8的讨论IntegrateDoctrinewithZendFramework1.8app该讨论没有考虑AutoLoader/Bootstrap系统。如果我用./zh.sh生成一个应用程序框架,我将如何集成Doctrine。 最佳答案 找到解决方案http://pastie.org/481635http://pastie.org/481633在application/configs/application.ini中设置自动加载器和插件路径:autoloade

php - 使用 Doctrine 获取随机记录

我想知道如何从一个组中获得随机数量的成员,但我不知道最好的方法是什么,而且我认为ORDERBYRAND()不是最好的或者,由于一个组可以有超过100,000个成员,执行这种类型的查询可能会非常慢。我发现这种使用SQL的方法,但我不知道如何在DQL中做同样的事情:HowcanioptimizeMySQL'sORDERBYRAND()function? 最佳答案 为了不降低性能,我通常会这样做://RetrievetheEntityManagerfirst$em=$this->getEntityManager();//Getthenum

php - Doctrine 2 : Can entities be saved into sessions?

将实体保存到PHPsession后,延迟加载出现问题。有什么解决方法吗? 最佳答案 参见SerializingEntities在Doctrine手册中:(您在session中保存的所有内容都被序列化和反序列化。)Serializingentitiescanbeproblematicandisnotreallyrecommended,atleastnotaslongasanentityinstancestillholdsreferencestoproxyobjectsorisstillmanagedbyanEntityManager.

Eslint配置 Must use import to load ES Module(已解决)

最近在配置前端项目时,eslint经常会碰到各种报错(灰常头疼~)SyntaxErrorErrorNoESLintconfigurationfound.SyntaxError:Error:D:\dmq\dmq-ui.eslintrc.js:Environmentkey“es2021”isunknownatArray.forEach()errorin./src/main.jsSyntaxError:Error:Cannotfindmodule‘@vue/cli-plugin-babel/preset’from‘D:\dmq\dmq-ui’atArray.map()ImportDeclaratio

php - 如何在 Doctrine 中使用 "comment out"注释条目

给定以下带有PHPDoc注释的属性,其中包含Doctrine的注释:/***@ORM\Column(name="id",type="integer")*@ORM\Id*@ORM\GeneratedValue(strategy="AUTO")*/private$id;“注释掉”注释行之一的最佳方法是什么?例如像这样:/***@ORM\Column(name="id",type="integer")*@ORM\Id*//Commentoutplease//@ORM\GeneratedValue(strategy="AUTO")*/private$id;这样做是否有受支持的方式或一般惯例?

php - 如何使用 KNPPaginatorBundle 对使用 Doctrine Repository 的结果进行分页?

我正在做一个Symfony2项目,我决定使用KNPPaginatorBundle来构建一个简单的分页系统。所以我创建了一个Product实体,我想将分页器添加到indexAction操作(由CRUD命令生成)。//Retrievingproducts.$em=$this->getDoctrine()->getManager();//$entities=$em->getRepository('LiveDataShopBundle:Product')->findAll();$dql="SELECTaFROMLiveDataShopBundle:Producta";$entities=$em

php - 我怎样才能在 Doctrine 中将 NULL 设置到表中

我有一些表store_section(id,parent_id,label),我想更改一些行,设置parent_id=null。我想:$record=$table->getTable()->find($id);$record->parent_id=null;$record->save();但这行不通。如何在Doctrine中将NULL设置到表中,在上面的示例中,parent_id变为=0(不是=NULL)?感谢回复! 最佳答案 我会尝试以下方法之一:1:$record=$table->getTable()->find($id);$r

php - 删除 Doctrine 中的记录

我想在Doctrine中删除一条记录,但我不知道为什么它不删除。这是我的代码:functiondel_user($id){$single_user=$entityManager->find('Users',$id);$entityManager->remove($single_user);$entityManager->flush();}另外:我如何回显查询以查看这里发生了什么? 最佳答案 这是一个老问题,似乎还没有答案。作为引用,我将其留在此处以供更多引用。您也可以检查doctrinedocumentation要删除记录,您需要(

php - 选择一列 Doctrine DQL

我需要一个简单的表格列。以表“project”为例,包含列id、name和year。如果我这样做:$q=Doctrine_Query::create()->select('a.pro_id')->from('fndr_proyectoa')->where('a.pro_id=?',1);$pro=$q->execute();json_encode($pro->toArray());答案全是列样{"id":1,"name":"Projectname","year":2013}但我只需要一栏。我希望:{"id":1}它适用于DQL,因为原生SQL可以正常工作。ORM是使用VisualPar