I've a problem in my form for the entity Page from simplecmsI want to add an item in the array Extras, so i added it in my formtype :
use Symfony\Component\Form\AbstractType;use Symfony\Component\Form\FormBuilderInterface;use Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page;class PageType extends AbstractType{ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('title', 'text', array('label' => 'Titre','attr' => array('placeholder' => 'Titre complet de la page') )) ->add('name', 'text', array('label' => 'Label','attr' => array('placeholder' => 'nom-simplifie-de-la-page') )) ->add('body', 'ckeditor') ->add('locale', 'hidden') ->add('publishable') ->add('extras_link','text', array('property_path' =>"extras['link']", )); }
The vars are in class Page (i didnt had to override it) and functions removeExtra() and addExtra() too (necessary to my form alimentation)
/** * Add a single key - value pair to extras * * @param string $key * @param string $value - if this is not a string it is cast to one */public function addExtra($key, $value){ $this->extras[$key] = (string) $value;}/** * Remove a single key - value pair from extras, if it was set. * * @param string $key */public function removeExtra($key){ if (array_key_exists($key, $this->extras)) { unset($this->extras[$key]); }}
form is working, but when i submit, it find removeExtra() but not addExtra()
"Found the public method "removeExtra()", but did not find a public "addExtra()" on class Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page"
Somebody already had this problem? or know how to add data in extras?THX (sorry for my english)