jjzjj

ArrayCollection

全部标签

mongodb - ArrayCollection 中的命名集合键

我正在寻找一种为ODMArrayCollection关联数组键的方法。实体具有以下映射:/***$fields**Theentitiesfields**@ODM\ReferenceMany(targetDocument="JobboardEntity\Entity\EntityField",sort={"name"="asc"},cascade={"all"})*@var\Doctrine\Common\Collections\ArrayCollection*/protected$fields;/***addField**Addasinglefieldtothefieldcollect

mongodb - Symfony2.1 通过 EmbedMany 将 ArrayCollection() 集合持久化到 MongoDB

我正在尝试使用Docrtrine(symfony2.1)将一些数据保存到MongoDB。这是我的实体://src/Acme/ReportsBundle/Entity/ReportCore.phpnamespaceAcme\ReportsBundle\Entity;useDoctrine\ODM\MongoDB\Mapping\AnnotationsasMongoDB;useDoctrine\Common\Collections\ArrayCollection;/***@MongoDB\Document(collection="registeredReports")*/classRepo

php - Doctrine manyToMany 返回 PersistentCollection 而不是 ArrayCollection

我正在使用Symfony3.1和Doctrine2.5。我一如既往地设置了一个多对多关系:manyToMany:placeServices:targetEntity:Acme\MyBundle\Entity\PlaceServicejoinTable:name:place_place_servicejoinColumns:place_id:referencedColumnName:idinverseJoinColumns:place_service_id:referencedColumnName:id并向我的实体添加方法protected$placeServices;...public

php - Doctrine manyToMany 返回 PersistentCollection 而不是 ArrayCollection

我正在使用Symfony3.1和Doctrine2.5。我一如既往地设置了一个多对多关系:manyToMany:placeServices:targetEntity:Acme\MyBundle\Entity\PlaceServicejoinTable:name:place_place_servicejoinColumns:place_id:referencedColumnName:idinverseJoinColumns:place_service_id:referencedColumnName:id并向我的实体添加方法protected$placeServices;...public

javascript - Symfony 2 中的 ArrayCollection(表单集合)索引冲突

我正在使用Symfony2来构建我的页面。当我尝试更新表单集合时(如食谱条目“HowtoEmbedaCollectionofForms”中所述),我发现前端索引与后端ArrayCollection索引发生冲突。我有关系UserAddress(OneToMany)。用户想要创建/更新/删除他的地址,因此他可以在javascript部分新地址元素的帮助下在前端添加/删除。他执行以下操作:(1)添加新地址(索引:0)(2)添加新地址(具有索引:1)并立即再次删除该地址(3)添加新地址(索引:2)。当他点击保存按钮时,以下代码保存/更新用户(及其地址):$this->em->persist($

javascript - Symfony 2 中的 ArrayCollection(表单集合)索引冲突

我正在使用Symfony2来构建我的页面。当我尝试更新表单集合时(如食谱条目“HowtoEmbedaCollectionofForms”中所述),我发现前端索引与后端ArrayCollection索引发生冲突。我有关系UserAddress(OneToMany)。用户想要创建/更新/删除他的地址,因此他可以在javascript部分新地址元素的帮助下在前端添加/删除。他执行以下操作:(1)添加新地址(索引:0)(2)添加新地址(具有索引:1)并立即再次删除该地址(3)添加新地址(索引:2)。当他点击保存按钮时,以下代码保存/更新用户(及其地址):$this->em->persist($

php - 如何合并两个 php Doctrine 2 ArrayCollection()

是否有任何方便的方法可以让我连接两个DoctrineArrayCollection()?类似:$collection1=newArrayCollection();$collection2=newArrayCollection();$collection1->add($obj1);$collection1->add($obj2);$collection1->add($obj3);$collection2->add($obj4);$collection2->add($obj5);$collection2->add($obj6);$collection1->concat($collectio

php - 对学说的@OneToMany ArrayCollection 进行排序

我的问题接近thisone,但与我的不完全吻合。我在实体中有此列:/***@varArrayCollection[SubjectTag]**@ORM\OneToMany(targetEntity="SubjectTag",mappedBy="subject")*@Assert\Count(max=10,maxMessage="Youcan'tcreatemorethan10tags.")*@Assert\Valid()*/protected$subjectTags;我想根据SubjectTag.position中定义的位置对我的标签进行动态排序。 最佳答案

php - Doctrine - 存储 ArrayCollection 键

每当我将ArrayCollection与DoctrineORM(2.3,PHP>5.4)一起使用,并将对象值与集合中的键相关联(例如使用set方法时),值得到正确存储在数据库中。但是当我想从实体中检索集合时,键没有被检索到,而是使用数字索引。例如,如果我有以下类:/**@Entity*/classMyEntity{/**@OneToMany(targetEntity="MyOtherEntity",mappedBy="mainEntity")*/private$myArray;publicfunction__construct(){$this->myArray=newArrayColl

php - 如何使用 Doctrine 的 ArrayCollection::exists 方法

我必须检查ArrayCollection中是否已经存在Email实体,但我必须对作为字符串的电子邮件执行检查(该实体包含一个ID和一些与其他实体的关系,因此我使用一个单独的表来保存所有电子邮件。现在,首先我写了这段代码:/***AnewEmailisadding:checkifitalreadyexists.**Inanormalscenarioweshoulduse$this->emails->contains().*ButitispossibletheemailcomesfromthesetPrimaryEmailmethod.*Inthiscase,theobjectiscrea