简体   繁体   中英

Sonata Project: an admin service for multiple entities

I have a doctrine Inheritance and I don't know how to manage it with Sonata

My parent

/**
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="discr", type="string")
 * @ORM\DiscriminatorMap({"abstract_page" = "AbstractPage", "content_page" = "ContentPage"})
 */
abstract class AbstractPage
{
    protected $name
}

One of the children

/**
 * @ORM\Table(name="content_page")
 */
class ContentPage extends AbstractPage
{
    protected $content;
}

Can I have a add button for each child but only a list view with all my entities which extends AbstractPage and when I select one of the page I need to have the view or the edit of the children.

You will need to use some advanced features from Sonata Admin. To read about them, please go to: http://sonata-project.org/bundles/admin/2-1/doc/reference/advance.html , specially "16.3. INHERITED CLASSES". This way you will have Add Buttons and create/edit views for each of your subclasses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM