Cake 3.6 Behavior not loaded


#1

Hi,

i’am using cake 3.6 and wanted to use the Friends of Cake Plugin Search. Since this version plugins shall be load in src/Application.php and not like in previous versions in conf/bootstrap.php

So in the file i 've wrote this.

 public function bootstrap()
    {
       ..
		try {
                $this->addPlugin(SearchPlugin::class,['routes'=>true,'bootstrap'=>true]);
		LOG::write(LOG_DEBUG,'SearchPlugin-Loaded');
            } catch (MissingPluginException $e) {
                LOG::write(LOG_DEBUG,$e);
            }
		
		
    }

When i take a look in debug.log i found the “SearchPlugin Loaded”

In the ModelTable i call

public function initialize(array $config) {
    parent::initialize($config);
   
    $this->addBehavior('Search');

When i call now my action, i get an Missing Behavior Error SearchBehavior could not be found.

Error: Create the class SearchBehavior below in file: src/Model/Behavior/SearchBehavior.php

It seems that the Plugin is not loaded successfully.

Does anyone know that?


#2

you need to add plugin prefix, like in readme you have $this->addBehavior('Search.Search');


#3

Thanks for your hint the Behavior is now loaded, the problem was, it was fine on development system…