Tuesday 15 June 2010

php - Symfony2 - Populate text field with ArrayCollection? -


I am using FPNTagBundle and I would like a text field to add tags to those entities, in the same way Works on this site one.

I can not create a new problem with the tag using the explosion, but when I come back to edit the unit, I get something like that in the text field.

Principle \ mango \ collection \ ARRIX @ 0000000062a07bb50000000047044868

Is there any way I can populate a text field with array archive, so that all tags Can be seen, different from one space?

What's currently in my controller:

  Actions of the public function editing page (request $ request, $ id = null) {$ em = $ this -> ; GetDoctrine () - & gt; GetEntityManager (); $ TagManager = $ this- & gt; Obtain ('fpn_tag.tag_manager'); $ Page = new page (); If (! Id ($ id)) {$ page = $ em- & gt; GetRepository ('content bundle: page') - & gt; FindOneById ($ id); $ TagManager- & gt; LoadTagging ($ page); } $ Form = $ this- & gt; CreateForm (new pagetype ($), $ page); If ($ request-> method is ('post')) {$ form-> Tie ($ request); If ($ form-> isValid ()) {$ em = $ this- & gt; GetDoctrine () - & gt; GetManager (); $ Em- & gt; Continues ($ page); $ Em- & gt; Flush (); $ $ Return - ($ -> -; Redirect generator url ('content_admin_list_sections');); }} $ Return - Return-> ('Content bundle: admin: p.HTML.twig', return array ('form' = & gt; $ form- & gt; createView);   

A simple example:

  public function  

conversion ($ tag) { $ Tag = $ tag- & gt; toArray (); if (count ($ tag) & lt; 1) return ''; and come back ('', $ tag);} Public function reverse transformer ($ string) { $ Tag = new array (); $ tag arrow = explosion ('', $ string); if (count ($ tag array)> $ tag = new array selection ($ tag array); $ Return tag;}

No comments:

Post a Comment