Questions tagged [arraycollection]

The ArrayCollection class is a wrapper class that exposes an Array as a collection in Flex which can be accessed and manipulated. Use this tag for questions related to arraycollection.

The ArrayCollection class is a wrapper class that exposes an Array as a collection that can be accessed and manipulated using the methods and properties of the ICollectionView or IList interfaces. Operations on a ArrayCollection instance modify the data source; for example, if you use the removeItemAt() method on an ArrayCollection, you remove the item from the underlying Array.

Reference

336 questions
85
votes
8 answers

How to merge two php Doctrine 2 ArrayCollection()

Is there any convenience method that allows me to concatenate two Doctrine ArrayCollection()? something like: $collection1 = new ArrayCollection(); $collection2 = new…
Throoze
  • 3,700
  • 8
  • 40
  • 62
64
votes
4 answers

Doctrine 2 ArrayCollection filter method

Can I filter out results from an arrayCollection in Doctrine 2 while using lazy loading? For example, // users = ArrayCollection with User entities containing an "active" property $customer->users->filter('active' => TRUE)->first() It's unclear for…
Dennis
  • 3,338
  • 8
  • 36
  • 45
30
votes
2 answers

Check if ArrayCollection is empty

I have an Entity Order which hold Suppliers in an Arraycollection. In my controller i want to check if this arraycollection is empty: $suppliers = $order->getSuppliers(); I tried: if(!($suppliers)) {} if(empty($suppliers)) {} Any ideas?
ChrisS
  • 706
  • 2
  • 8
  • 20
14
votes
1 answer

Doctrine2: check if exists value in Doctrine Collection

How can I check that given value exists in Doctrine Collection (ManyToMany relation) field? For example I try to: $someClass = $this-> getDoctrine()-> getRepository('MyBundle:MyClass')-> find($id); if…
spiil
  • 598
  • 3
  • 7
  • 19
13
votes
2 answers

Order of Symfony form CollectionType field

In my model I have a Recipe entity and Ingredient entity. In Recipe entity, the relation is defined like this: /** * @ORM\OneToMany(targetEntity="Ingredient", mappedBy="recipe", cascade={"remove", "persist"}, orphanRemoval=true) *…
Karolis
  • 2,419
  • 2
  • 14
  • 26
10
votes
4 answers

Arraycollection is being passed into function by value instead of by reference in flex 3

I want to set arrayCollection #2 = to arrayCollection #1 via a function in flex 3. I pass both array collections to a function and set arrayCollection #2 = arrayCollection #1. However, it seems to not be passing arrayCollection #2 by reference…
Steven
  • 1,729
  • 2
  • 16
  • 30
10
votes
1 answer

Symfony2: How to remove an element from a Doctrine ArrayCollection (many-to-many relation)?

I use the following code for my many-to-many relation in symfony2 (doctrine) Entity: /** * @ORM\ManyToMany(targetEntity="BizTV\ContainerManagementBundle\Entity\Container", inversedBy="videosToSync") * @ORM\JoinTable(name="syncSchema") */ private…
Matt Welander
  • 7,437
  • 20
  • 84
  • 129
7
votes
2 answers

Convert Vector. to Array?

Unfortunately in Actionscript, it seems like support for the Vector class isn't fully there yet. There are some scenarios where I need to convert a Vector into an array (creating an ArrayCollection for example). I thought this would do the…
Ocelot20
  • 9,720
  • 9
  • 49
  • 96
6
votes
2 answers

Doctrine 2.1: How to orderBy aggregate field in a collection?

I have an entity with a ArrayCollection field. In the annotations I can write @ORM\OrderBy({"somefield" = "DESC"}) and the collection I get from that entity will be automatically ordered. My question is if it is possible to order by aggregate…
Tony Bogdanov
  • 6,238
  • 10
  • 45
  • 74
6
votes
2 answers

doctrine ORM count arraycollection in where condition

Using Symfony2.8 with Doctrine 2.5, I want to filter in a Doctrine ORM query all datasets where the arraycollection contains exactly 3 elements. $em = $this->getDoctrine()->getManager(); $query =…
Immanuel
  • 61
  • 1
  • 3
6
votes
1 answer

Map a form's text field to an entity's ArrayCollection

I am using tags on a form using tagsinput : This plugin ends-up with a single text field containing tags separated by a comma (eg: tag1,tag2,...) Those tags are currently managed on a non-mapped form field: $builder // ... …
Alain Tiemblo
  • 32,952
  • 14
  • 114
  • 147
6
votes
4 answers

Passing an ArrayCollection from ColdFusion to Flex (with BlazeDS)

When pushing objects from ColdFusion to Flex via BlazeDS, and mapping the classes using RemoteClass... [RemoteClass(alias="blah.blah")] ...is it possible to have ColdFusion "Arrays" (or some Java equivalent) automatically mapped to ActionScript…
stubotnik
  • 1,922
  • 2
  • 17
  • 31
5
votes
1 answer

Expected argument of type "Doctrine\Common\Collections\ArrayCollection","Doctrine\ORM\PersistentCollection" given

I have a many to many relationship between Tag and Article entities, the insertion works well but the creation of the edit form (the editAction function) does not work. All the code is there: Article.php
5
votes
4 answers

Why does Flex's ArrayCollection's Contain method look at memory reference?

When using .contains() on an ArrayCollection in Flex, it will always look at the memory reference. It does not appear to look at an .equals() method or .toString() method or anything overridable. Instead, I need to loop through the ArrayCollection…
DyreSchlock
  • 870
  • 3
  • 13
  • 24
5
votes
1 answer

ArrayCollection in Symfony

since I'm quite new to Symfony and Doctrine I got a maybe stupid question ;-) Can someone use simple words to explain Collections (especially ArrayCollections in entities) to me? What is it and when and how to use them? (Maybe in an simple…
Felix2000
  • 75
  • 1
  • 6
1
2 3
22 23