Right now i'm working with Sonata in order to create the backoffice administration site, i've created two separated admins - one for each entity - but i don't want force the users to manage each entity separately. I would like to present a whole form where one can add/remove child elements.
Does anyone worked on a use case like that one? Could would you proceed?
PD: On some cases entities relation chain is about 4 or 5 levels, so mean 4 or 5 entities are related between them and would like to find a valid solution for all cases and being able to manage it all as simple as possible. Thanks in advanced!
- Code: Select all
Class Foo
{
/**
* @ORM\Id
* @ORM\Column( type="integer", length="4" )
* @ORM\GeneratedValue( strategy="AUTO" )
*/
private $id;
/** @ORM\OneToMany( targetEntity="FooI18n", mappedBy="foo" ) */
private $childs;
}
Class FooI18n
{
/**
* @ORM\Id
* @ORM\Column(type="integer", length="4", name="id")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\ManyToOne( targetEntity="Foo", inversedBy="childs" )
* @ORM\JoinColumn( name="foo_id", nullable=false, referencedColumnName="id", onDelete="CASCADE" )
*/
private $foo;
/**
* @ORM\Column( type="text", nullable=false, unique=false, name="content" )
*/
private $content;
