Here is my TagAdmin class
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('description')
->add('slug','text',array(
'read_only' => true,
))
->add('categories', 'sonata_type_model', array('expanded'
=> true, 'multiple' => true));
}
There is a manyToMany mapping
between Categories and Tags.
I recently upgraded to Sonata Admin version 2.0.
I am sure it was working earlier, but now when I add new Categories to a Tag, I get a success flash message, but the change is not reflected.
The only other change I had made was to integrate the Chosen JQuery plugin for handling checkboxes. I have tried with removing that too, but it functions just the same.
What could be going wrong?
Here is the Tag class.
class Tag
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $name
*
* @Gedmo\Sluggable(slugField="slug")
* @ORM\Column(name="name", type="string", length=255)
* @Gedmo\Translatable
*/
private $name;
/**
* @var text $description
*
* @ORM\Column(name="description", type="text")
* @Gedmo\Translatable
*/
private $description;
/**
* @ORM\ManyToMany(targetEntity="Category", mappedBy="tags")
*/
protected $categories;
/**
* @var string $slug
* @Gedmo\Slug(updatable=false)
* @ORM\Column(name="slug", type="string", length=255)
*/
private $slug;
public function __construct()
{
$this->categories = new \Doctrine\Common\Collections
\ArrayCollection();
}