在 shell 中使用模式

Use schema in shell

在插件上下文中,我正在编写 shell 子命令,我需要调用架构的 public 方法:

// app\Plugin\FooManager\Config\Schema\schema.php
App::uses('BaseSchema', 'FooManager.Config/Schema');
class FooManagerSchema extends BaseSchema {
    public function getLocalisableValues() {
    }
}

像往常一样,我搞不懂语法。

// app\Plugin\FooManager\Console\Command\DevShell.php
class DevShell extends AppShell {
    public function i18n_dump_database_values() {
        $schema = ????????;
        $schema->getLocalisableValues();
    }
}

如何将 FooManagerSchema 的实例加载到 $schema 中?

不惜一切代价让它工作的可耻无蛋糕解决方法(请不要在家里尝试,小猫可能会受伤):

// app\Plugin\FooManager\Console\Command\DevShell.php
class DevShell extends AppShell {
    public function i18n_dump_database_values() {
        // Ugly (and will possibly break things):
        include_once(__DIR__ . '/../../../../../lib/Cake/Model/CakeSchema.php');
        include_once(__DIR__ . '/../../Config/Schema/schema.php');
        $schema = new FooManagerSchema();

        $schema->getLocalisableValues();
    }
}