草庐IT

doctrine

全部标签

php - Doctrine ORM,两个不同的查询产生相同的结果集

我正在使用Doctrine1.2和Symfony1.4。在我的操作中,我有两个不同的查询返回不同的结果集。不知何故,第二个查询似乎改变了第一个查询的结果(或引用?),我不知道为什么......这是一个例子:$this->categories=Doctrine_Query::create()->from('CategorieASc')->innerJoin('c.ActiviteASa')->where('a.archive=?',false)->execute();print_r($this->categories->toArray());//Return$this->categori

php - 如何在 DELETE QUERY 中编写 LEFT JOIN?

你能给我一个使用Doctrine的左连接的删除查询的例子吗? 最佳答案 这是不可能的。看到:http://trac.doctrine-project.org/ticket/2142您必须在where子句中使用子查询:http://www.doctrine-project.org/documentation/manual/1_2/en/dql-doctrine-query-language:subqueries尝试这样的事情:$q=Doctrine_Query::create()->delete('TableBb')->where('

php - 后端的 url_for 或 link_to 与管理生成器 Symfony

在backend_dev中,我使用管理生成器模块生成新闻:localhost/backend_dev.php/news/2/editthisislinkforeditNewsID2.HowcanigeneratethislinkforotherID?url_for('news/edit?id=2')不工作,输出是:localhost/backend_dev.php/news/edit/action?id=1Inroutingihaveonly:news:class:sfDoctrineRouteCollectionoptions:model:Newsmodule:Newsprefix_

php - Doctrine 一对多无连接表

我正在使用Doctrine,我想知道我是否可以在不使用连接表的情况下建立一对多关系? 最佳答案 取决于您希望它是单向的还是双向的。单向一对多只能通过jointable实现,出于“意识形态”的原因,来自Java的hibernate:http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many-unidirectional-with-join-table假设您有一个包含许多产品

php - 如何在 symfony2 中为实体 ManyToOne 关系嵌入表单?

我是Symfony2Framework的新手。我想为实体ManyToOne关系形成嵌入。我必须实体Address和AddressType地址实体namespaceWebmuch\ProductBundle\Entity;useDoctrine\ORM\MappingasORM;classAddress{private$id;private$line1;private$city;private$zip;private$phone;/***@varstring$type**@ORM\ManyToOne(targetEntity="AddressType")*@ORM\JoinColumn(

php - Symfony2.1映射错误: class_parents()

我在Symfony2.1项目中尝试使用Doctrine2从表(通过实体)获取数据时遇到问题。这是我收到错误的Controller:/***Countrylist*/publicfunctioncountrylistAction(){$em=$this->getDoctrine()->getManager();$countryList=$em->getRepository('ProjectBaseBundle:SYS_TCountry')->findAll();$serializer=newSerializer(array(newGetSetMethodNormalizer()),arr

php - 不同束中实体之间的 Doctrine 关联映射或来自两个不同束的相关实体?

地区:namespaceAcme\RegionBundle\Entity;classRegion{private$id;/***@ORM\OneToMany(targetEntity="User")*@ORM\JoinColumn(name="region_id",referencedColumnName="id")*/private$users;}用户:namespaceAcme\UserBundle\Entity;classUser{private$id;private$region_id;}如何在不提及完全指定的实体路径(即硬编码依赖性)的情况下关联来自不同包的实体。有没有更好的

php - 级联坚持不工作(Doctrine ORM + Symfony 2)

几个月前我开始使用symfony,有一件事一直困扰着我。当我在Doctrine中有一个一对多的关系时,我试图向数据库中插入一些东西。这是一个例子:经纪人.orm.ymlAcme\DemoBundle\Entity\Broker:type:entitytable:brokersrepositoryClass:BrokerRepositoryid:id:type:integergenerator:{strategy:AUTO}fields:name:type:stringlength:255slug:type:stringlength:64oneToMany:accountTypes:ta

php - 交响乐 2.3 : CollectionRegionDoctrineCommand not found when update vendors and clear cache

在我实现供应商之前一切正常。然后,当我清理缓存时,出现以下错误:PHPFatalerror:Class'Doctrine\ORM\Tools\Console\Command\ClearCache\CollectionRegionCommand'notfoundin/var/app/ondeck/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CollectionRegionDoctrineCommand.phponline29 最佳答案

php - Doctrine QueryBuilder 重用部分

我想计算所有符合我的条件的字段,并使用条令查询生成器逐页获取它们。我生成的查询取决于我的过滤字段。第一部分是计算记录数,这样我就可以计算页数了。$qb=$em->createQueryBuilder();$qb->select('COUNT(m.id)')->from('CSMediaBundle:MediaItem','m')->where($qb->expr()->eq('m.media',$media->getId()));$filters=$request->request->get('filter');if(!empty($filters['size'])){foreach(