Create new table using Pimcore DAO


I’ve been working on implementing a Custom Persistent Model per this guide:

I’m wondering if there’s a way to have it create the table in the $tableName variable, if the table doesn’t already exist when saving? Most of the guides and things suggest creating this manually, but I’d like to automate that, if possible.

if (!Db::get()->getSchemaManager()->tablesExist(['my_custom_table']) {



Thank you for the reply and the code sample. Just to clarify, is that for the Doctrine approach, or for the Pimcore DOA? And perhaps it doesn’t matter?


it doesn’t matter, it just checks if the table already exists. you can then go ahead and use the schema-manager to create the table, or you use the DAO thing and just execute the CREATE TABLE statement directly


Got it to work. Thank you for pointing me in the right direction.