arraycollection

Symfony use setter for Arraycollection in CreateController

主宰稳场 提交于 2019-12-24 18:50:22
问题 I'd like to create an upload form for documents. It's possible to select several so called 'agencies' and each of these agencies belongs to one specific market. What I want to do is, set the markets automatically. So in my controller I had something like this: $document->setMarket($document->getAgencies()->getMarket()); But since the agencies are an ArrayCollection, I can't call a getter on them. So I was thinking about a for each loop in order to get the markets for every single agency.

Merge data into filtered ArrayCollection (maybe by using IViewCursor or localIndex?)

孤者浪人 提交于 2019-12-19 11:24:11
问题 I have a Flex question, which isn't as easy as it seems at first. At least I'm struggling since 1 week with it. I have prepared a test case and a screenshot. The question is: how do you merge data (coming repeatedly from server) into a filtered ArrayCollection? The screenshot: The TestCase.mxml (just place it into a Flash Builder 4.6 project): <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx

Sending ArrayCollections via P2P Flex

社会主义新天地 提交于 2019-12-13 18:08:57
问题 I have a question regarding P2P with flex. When passing data between two applications using P2P. I get the following error: warning: unable to bind to property 'piece' on class 'Object' (class is not an IEventDispatcher) I've spent a few days using Google to try and find a solution, but a can't get rid of that error. I've tried using ObjectUtils, direct assignment, and creating a new ArrayCollection WITH the ObjectUtils inside the parenthesis and still can't solve the problem. Purpose of code

Fastest way to get an Objects values in as3

一笑奈何 提交于 2019-12-13 16:46:08
问题 Ok, so I swear this question should be all over the place, but its not. I have a value object, inside are lots of getters/setters. It is not a dynamic class. And I desperately need to search an ArrayCollection filled with them. The search spans all fields, so and there are about 13 different types of VOs I'll be doing this with. I've tried ObjectUtil.toString() and that works fine and all but it's slow as hell. There are 20 properties to return and ObjectUtil.toString() adds a bunch of junk

Flex arraycollection sorting not working

孤街醉人 提交于 2019-12-12 02:44:15
问题 I am trying to sort a list of string stored in an arraycollection. But the sorted result is not correct. Please see my code. spark.collections.Sort if(value is ArrayCollection){ var sort:Sort=new Sort(); var sortField:SortField = new SortField("data") sortField.numeric=false; sort.fields=[sortField]; ArrayCollection(value).sort=sort; ArrayCollection(value).refresh(); } Input: Start With, Contains, End With, Equals IgnoreCase, Not Equals, Matching, Equals Output: Equals IgnoreCase, Contains,

Symfony2 - Doctrine ArrayCollection methods coming back as undefined

*爱你&永不变心* 提交于 2019-12-11 18:59:33
问题 This is odd. I have an entity that can contain an ArrayCollection of other, related entities. When I make a couple of helper methods to allow me to add/retrieve the value of a singular entity, I get a Symfony2 exception telling me the method is not defined. I'm including the namespace, so I'm at a loss as to what the problem is. Code (names changed slightly due to a NDA) below: namespace Acme\MyBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; //

ArrayCollection: retrieve collection in a form

╄→尐↘猪︶ㄣ 提交于 2019-12-11 12:39:29
问题 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 user. There are more than only one mission for every user; so, when he uploads a $product object, he should also be able to select the mission he prefers. To upload the file I use a form in a controller in the following way: $form = $this-

Twig extension for sorting Doctrine ArrayCollection

点点圈 提交于 2019-12-11 10:35:24
问题 I'm trying to write a Twig filter to be able to sort a Doctrine ArrayCollection, but the returned array is not sorted :( Can you please help me to fix this: class SortExtension extends \Twig_Extension { public function getFilters() { return array( new \Twig_SimpleFilter('sortby', array($this, 'sortByFilter')), ); } public function sortbyname( $a, $b ) { if ($a->getName() === $b->getName()) { return 0; } if ( $a->getName() < $b->getName() ) { return 1; } return -1; } public function

Symfony 3 - difference between 2 arraycollection

不羁的心 提交于 2019-12-11 03:37:06
问题 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. 回答1: You can use array_diff in the following way: $diff = array_diff($arrayCollection1->toArray(), $arrayCollection2->toArray()); $arrayCollectionDiff = new ArrayCollection($diff); 回答2: I would suggest the following: A class made of two functions: function getElementFromANotInB gives the elements from ArrayCollection A not in

How to customize data-prototype in symfony2 form collections?

醉酒当歌 提交于 2019-12-05 05:52:26
问题 I've got a collection of hidden fields in my form. <ul id="user_roles"> <li><hidden field value="role1"></li> <li><hidden field value="role2"></li> (...) </ul> I use jQuery (and data-prototype) to add new roles. The problem is that I would like to render something like this: <ul id="user_roles"> <li>role1 <hidden field value="role1"></li> <li>role2 <hidden field value="role2"></li> (...) </ul> No problem with the initial rendering: i just put: {% for role in roles %} <li> {{ role }} {{ form