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
1
vote
2 answers

Symfony 3, ArrayCollection's remove() causes error of "Warning: Illegal offset type in isset or empty"

I have a Wishlist entity, which has relationship with a Product entity using MTM Doctrine annotation. I have the definition that $products is an Array Collection In Wishlist's __construct() and that's why I have addProduct() and removeProduct()…
Varg
  • 402
  • 1
  • 6
  • 24
1
vote
0 answers

Array Collection: How does the set method work?

This is maybe a stupid question but I can't figure it out... I am trying to build a basic parent/child entity for a forum in doctrine. I have defined my entities and the relationship ManyToOne. I added a method with an array collection on the side…
Shaker81
  • 47
  • 1
  • 12
1
vote
1 answer

Cannot figure out why List won't display data from ArrayCollection

I'm working on a flash cards application and am using an ArrayCollection of Objects to store each cards individual data. When the user click the 'save' button, the text from the two textAreas and the 'title' textinput are stored in the AC as one…
1
vote
1 answer

Setting dataProvider to a comboBox

When setting an arrayCollection as a dataProvider to a comboBox programmatically,if the arrayCollection has just one element,i need to do a small validation: > public resultHandler(event:ResultEvent):void{ arrColl =…
himanshu
  • 392
  • 3
  • 17
1
vote
1 answer

How to backup an ArrayCollection before removing element?

So I want to store the ArrayCollection value, delete it and then reuse it in another entity. But it seems that the value is passed by reference so when its unset, the stored value is also unset. $children =…
Chuck Norris
  • 1,125
  • 1
  • 12
  • 28
1
vote
0 answers

Doctrine 2 how to index collections

Can you explain me please, how to index Doctrine entity collections? I have an entity Article with collection of related Categories defined as @ManyToMany relationship. In this annotation I have parameter indexBy="id" which I hope creates an array…
Čamo
  • 3,863
  • 13
  • 62
  • 114
1
vote
0 answers

Symfony get dropdow for each related property in a form

another Symfony form Question. I have an entity "Product". This entity has related featureTypes. E.g. Product "iPhone" has Featuretpyes "RAM, Display, Prozessor". Also I have an entity "Feature". Each Feature has a featureType. Well, what do i want…
1
vote
1 answer

Symfony FormType, get Dropdown from Arraycollection

i have my Entity Product with an Arraycollection of featureTypes (ManytoMany) Class Product: /** * @var FeatureType * * @ORM\ManyToMany(targetEntity="AppBundle\Entity\FeatureType", mappedBy="products") */ private $featureTypes; public function…
1
vote
1 answer

Symfony retrieve data from Array Collection

In Symfony I am using a query to retrieve all questions and their relative answers from a database. Using a for in twig I am trying to display in a table all questions with the relative answers row by row. At the moment I am able to access and…
user3810730
1
vote
0 answers

Symfony 2: persist entity with one to many relationship

I have an entity Project that is related with some files via one-to-many relationship like this: class projects{ /** * @ORM\Column(type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; …
iiirxs
  • 4,493
  • 2
  • 20
  • 35
1
vote
0 answers

Doctrine Arraycollection not found @external host but working on local XAMPP

Iam new with php and creating an rest API for test purposals (for an android app). I use doctrine as ORM for my PHP project and it works fine localy with XAMPP. Since i uploaded the project to an external hosting provider i got constantly an…
CodeNinja
  • 836
  • 1
  • 15
  • 38
1
vote
1 answer

Symfony - Items from an ArrayColletion is removed, but is still shown in the list

I have Budget, BudgetItem and Product entities. A Budget has a BudgetItem list, which has one or more Products. I am trying to remove a list of these previously added products following the this tutorial. When I try to remove an existing Product…
GabrielMF
  • 31
  • 1
  • 6
1
vote
1 answer

Embed form in ArrayCollection Symfony2

I have form: My code to Tag1 look like: $builder ->add('tag1', 'collection', [ 'type' => 'text', 'label' => 'Tag1', 'allow_add' => true, 'allow_delete' => true, …
Ivan
  • 2,463
  • 1
  • 20
  • 28
1
vote
3 answers

C# - Any clever way to get an int array from an object collection?

How can I create an easy helper method to get an int array from a collection of objects? The idea would be have a method which receive a collection of "User" class: public class User { public int UserId {get;set;} public string UserName…
Junior Mayhé
  • 16,144
  • 26
  • 115
  • 161
1
vote
3 answers

class object in class with php oop

I am not even sure how to ask. I do this all the time in C# but for the life of me I cannot find any decent examples in PHP. Can you help? What I am trying to do is for example. Say I have a class called Company who has many Employees. I want to…
nitefrog
  • 1,760
  • 6
  • 31
  • 59