How to access the SQLs of the updates made by the Doctrine schema?

1

I have an application running on a server (production) that does not give access to ../vendor/bin/doctrine and therefore I can not run the commands, like orm:schema-tool:update , for example. I'm running the commands in my development environment, typically.

How do I access the commands executed by orm:schema so that I can run them correctly in my production environment, simulating the ORM action itself and keeping the banks properly paired?

    
asked by anonymous 21.04.2015 / 03:20

1 answer

0

Instead of accessing the ../vendor/bin/doctrine executable commands, you can create a web-accessible script (of course, with some authentication required) to do what you need.

See this section in Doctrine documentation .

In short, just instantiate SchemaTool by passing its EntityManager as an argument, and call the updateSchema method by passing the classes of your application as an argument:

<?php

$tool = new \Doctrine\ORM\Tools\SchemaTool($em);

$classes = array(
  $em->getClassMetadata('Entities\User'),
  $em->getClassMetadata('Entities\Profile')
);

$tool->updateSchema($classes);
    
21.04.2015 / 16:57