Answer the question
In order to leave comments, you need to log in
How to completely copy a table structure through Doctrine?
Please tell me how to completely copy a table through Doctrine, including indexes and foreign keys (ForeignKeyConstraint).
For example, this code will return an SQL query only to create a table with indexes, but without foreign keys:
$tool = new SchemaTool($this->em);
$metadata = $this->em->getClassMetadata(<Любая сущность, имеющая внешние ключи>::class);
$tool->getCreateSchemaSql([$metadata]); // вернет массив из 1го элемента (но по идее должен вернуть больше элементов с SQL-запросами на создание внешних ключей)
CREATE TABLE new_tbl LIKE orig_tbl;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question