0

我知道这可能是一个愚蠢的问题,但是几个小时以来我一直在努力解决这个问题,我无法解决这个错误。

我在我的一个项目中使用https://github.com/CakeDC/Enum

在我的src/Model/Table/CarsTable.php我有这个,在initialize()方法中:

    $this->addBehavior('CakeDC/Enum.Enum', ['lists' => [
        'stato' => [
            'strategy' => 'const',
            'prefix' => 'STATO'
        ]
    ]]);

在我的时候CarsController我有这个

/**
* Cars Controller
*
* @property \App\Model\Table\CarsTable $Cars
* @property \App\Controller\Component\PermissionComponent $Permission
* @property \App\Controller\Component\LoggerComponent $Logger
* @method \App\Model\Entity\Car[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class CarsController extends AppController
{
    ...

    public function add()
    {
        ...
        $this->set('stato', $this->Cars->enum('stato'));
        ...
    }

enum方法是从它的插件继承的,它不是我的CarsTable. 这意味着当我运行时出现phpstan analyze src此错误:

Line   Controller/CarsController.php                                   
69     Call to an undefined method App\Model\Table\CarsTable::enum().  

我怎样才能解决这个问题?

4

0 回答 0