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

340 questions
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
4
votes
1 answer

Symfony expected must be an instance of Doctrine\Common\Collections\ArrayCollection, instance of Doctrine\ORM\PersistentCollection given

I am using Symfony 2.8 I have a many to many relationship between User and Sectors entities, the insertion works well but the creation of the edit form (the editAction function) does not work. All the code is there:
Abha Rana
  • 195
  • 1
  • 4
  • 13
4
votes
3 answers

Symfony 4 : ArrayCollection add not persisting in database

I have the following entity in Symfony : class User implements AdvancedUserInterface, \Serializable { ... private $roles; ... public function __construct() { ... $this->roles = new ArrayCollection(); //…
JeanneD4RK
  • 323
  • 1
  • 5
  • 19
4
votes
2 answers

Symfony. After submit form does not contain a single element in the ArrayCollection for its fields from the CollectionType

My model contains two related classes - RealEstate and Image, and for one instance of RealEstate can be a lot of Image's instances. Since the Image class can also be used in association with other classes, I chose relationship 'One-To-Many,…
4
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
  • 867
  • 3
  • 13
  • 24
4
votes
2 answers

mx.collections missing? ArrayCollection() in Flex4 (Flash Builder 4)

I have some code that uses an ArrayCollection, it imports: import mx.collections.ArrayCollection; then: static protected var myAC:ArrayCollection = new ArrayCollection(); Seems straightforward, but in my project the import (and thus…
4
votes
1 answer

Reindexing ArrayCollection elements in RESTAPI

Imagine, I've an array collection $items, and implemented a method removeItem in my SomeEntity entity class, public function removeItem(Item $item) { $this->items->removeElement($item); return $this; } and a controller action which receives…
xurshid29
  • 4,172
  • 1
  • 20
  • 25
4
votes
1 answer

Object of class Doctrine\ORM\PersistentCollection could not be converted to string

I made a web application with Symfony2, in which a User has an array correlation ManytoMany with the entity Mission. The User can upload the entity $product through a form, and one of the data passed by the form is the mission associated to the…
Gianni Alessandro
  • 860
  • 6
  • 11
  • 28
4
votes
2 answers

collection Field Type not creating form elements

I'm trying to create a form which will add a new text box every time the 'Add new box' link got clicked. I read through the following example. http://symfony.com/doc/current/reference/forms/types/collection.html Basically I was following the example…
Dhanushka
  • 82
  • 1
  • 8
3
votes
1 answer

When to use ArrayCollection or Array in as3?

I know that an ArrayCollection is a wrapper over an Array, but what I wanted to know is when to choose one over the other? Will the over usage of ArrayCollections result in performance?
midhunhk
  • 5,560
  • 7
  • 52
  • 83
3
votes
5 answers

Iterating over ArrayCollection while adding and removing items

I want to iterate over an ArrayCollection in Flex while there can be items added and removed. Since i didn't find a way to use a "classic" Iterator like in Java, which would do the job. I tried the Cursor. But it doesn't really work the way i want…
Dukeatcoding
  • 1,363
  • 2
  • 20
  • 34
3
votes
1 answer

Difference between returning each object or one arrayCollection

public function getInvoiceItemsByType($type) { return $this->invoiceItems->filter(function ($invoice) use ($type) { /** @var InvoiceItem $invoice */ return $invoice->getType() == $type; } ); } public function…
j.y
  • 37
  • 3
3
votes
4 answers

Add distinct values to array collection

Within my application I am sending out notifications to different users, which are assigned to agencies, which are assigned to documents. So whenever a document gets created and an agency is assigned to that document, all the users belonging to that…
sonja
  • 924
  • 1
  • 21
  • 52
3
votes
1 answer

Length of filtered ArrayCollection in actionscript 3/flex

I need to display the number of items in a List component that has a filtered ArrayCollection as its data provider. I don't see a way to get the filtered collection's length. Anyone know? Thanks.
JackFreud
  • 31
  • 1
  • 2
3
votes
3 answers

Symfony 3 - difference between 2 arraycollection

Is there a way to differentiate 2 ArrayCollection ? (like array_diff) today I loop on the first and check if $it->contains() match, but I think it can be refactored.
arno
  • 792
  • 14
  • 33
1
2
3
22 23