Sulu: Where to place XML file for custom entity?

217 Views Asked by At

I'm following documentation for adding custom entities in Sulu:

https://docs.sulu.io/en/2.2/book/extend-admin.html#list-configuration-and-controller

and it describes how to create XML file that additionally describes my custom entity type, but it's not mentioned where to place that file and how to name it?

<?xml version="1.0" ?>
<list xmlns="http://schemas.sulu.io/list-builder/list">
    <key>events</key>

    <properties>
        <property name="id" visibility="no" translation="sulu_admin.id">
            <field-name>id</field-name>
            <entity-name>App\Entity\Event</entity-name>
        </property>

...

So how to name and where to place that XML file please?

1

There are 1 best solutions below

3
On BEST ANSWER

Theoretically you can place such files wherever you want, as long as you configure the paths of those directories, so that sulu knows, where it can find it. But sulu automatically configures config/forms/ as directory to search for forms and config/lists/ for lists. So in most cases you should use those directories. Using other directories is just necessary, if you want to create forms or lists in a custom bundle.

About the naming, it's recommended to name the file the same as the list key, in your case events.xml