无法加载 cakephp 模型



我有 cakephp 2 和 websockets 的棘轮框架。所有这些都适用于 aws ec2。我创建了一些php类并尝试使用cakephp模型,如下所示:

<?php
namespace somenamespace;
use App;
use CakeModel;
App::uses('CakeModel', 'Model');
use RatchetConnectionInterface;
require_once 'path/to/autoload.php';
require_once 'path/to/Cake/Core/App.php';
class SomeClassThatUseRatchetThings {
    public function foo(ConnectionInterface $from) {
        $cakeModel = new CakeModel();
        ...

我启动服务器(wsserver),一切正常,直到我调用foo函数。当我调用它时,我有休耕错误:

类"蛋糕模型"未在 中找到 /path/to/SomeClassThatUseRatchetThings.php 在第 20 行

为什么会这样?我错过了什么?谢谢。

非常奇怪的行为。我添加了这样的require_once bootstrap.php

require_once ROOT. DS . APP_DIR . DS . 'vendor' . DS . 'autoload.php';
require_once ROOT . DS . 'lib' . DS . 'Cake' . DS . 'Core' . DS . 'App.php';
require_once ROOT . DS . 'lib' . DS . 'Cake' . DS . 'bootstrap.php';

这个错误消失了,但还有另一个错误:

无法重新声明类应用.php

我试图将第二个require_once移动到另一个文件,我的代码给了我想要的东西。没有错误+能够使用蛋糕模型。

最新更新