CakePHP 2:如何在Controller中运行从SchemaShell类生成的方法


CakePHP 2: How to run method generate from SchemaShell class in Controller

我想从控制器中的一个操作生成"schema.php"。我试过:

$m = new SchemaShell();
$m->params = array('force');
$m->generate();

但这行不通。显示两条通知。

如何使其发挥作用?

谢谢。

解决方案:

$m = new SchemaShell();
$m->params = array('force' => 1, 'file' => 'schema.php');
$m->startup();
$m->generate();