Doctrine 2 CLI中的CLI命令 [英] Doctrine 2 CLI commands from within PHP
问题描述
php ./doctrine orm:convert-mapping --filter =users--from-database yml ./test
这个命令可以从Linux命令行中工作,但是如何通过Doctrine对象来做同样的事情?我不想使用PHP exec语句将命令发送到shell。我想使用Doctrine对象模型。
Don!:
<显然这不是一个非常常见的编程方法。但是,通过PHP EXEC命令调用它,我已经使用了Doctrine。我知道你说你不会这样做。然而,它实际上是很好的。以下是此类解决方案的示例。
$ cmd_string =php ./doctrine orm:generate-entities --generate-annotations = 1 --regenerate-entities = 1 $ this-> entity_file_dir;
$ result = array();
exec($ cmd_string,&$ $ result);
希望这有帮助,
-Don!
Hey all. I am writing a program that will transform some data in our database, and then call Doctrine to build YAML files from said Mysql Database structure. I have Doctrine working from within PHP. However I can't figure out how to call the CLI commands from within PHP. Following is the Doctrine 2 CLI command that does what I need.
php ./doctrine orm:convert-mapping --filter="users" --from-database yml ./test
This command works from the Linux command line, but how to I do this same thing via Doctrine objects? I don't want to just use the PHP exec statement to send a command to the shell. I wish to use the Doctrine object model.
Don!:
Apparently this is not a very common programming method. However, I have used Doctrine from PHP by calling it via the PHP EXEC command. I know you said that you would not like to do it this way. However, it actually works quite well. Below is an example of such a solution.
$cmd_string = "php ./doctrine orm:generate-entities --generate-annotations=1 --regenerate-entities=1 $this->entity_file_dir"; $result = array(); exec($cmd_string, &$result);
Hope this helps, -Don!
这篇关于Doctrine 2 CLI中的CLI命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!