I have been wondering around articles on google trying to "find a way" to create tables using doctrine. I need to create "temporary tables" because the project I am working on will have a lot of "temp statistics" and I do not need to have all the information, just a "total" at some point. Anyway MYSQL "temporary" tables would just be the "solution".
However, I cannot find a single piece of information where it shows you how to create tables with Doctrine.
I understand that Doctrine needs the tables to be created and the entities, but there must be a way to create tables "on-the-fly", or a way to run raw queries.
Here's a piece of code I have tried, and of course it failed:
$schema= new \Doctrine\DBAL\Schema\Schema();
//if (!$schema->tablesExist('post'))
//{
$table= new \Doctrine\DBAL\Schema\Table('post');
$table->addColumn('id', 'integer', ['autoincrement'=>true]);
$table->addColumn('title', 'text', ['notnull'=>true]);
$table->addColumn('content', 'text', ['notnull'=>true]);
$table->addColumn('status', 'integer', ['notnull'=>true]);
$table->addColumn('date_created', 'datetime', ['notnull'=>true]);
$table->setPrimaryKey(['id']);
$table->addOption('engine' , 'InnoDB');
$schema->createTable($table); // save to DB
//}
Can someone please clarify to me if tables can or cannot be created with Doctrine ?
Many Thanks.