w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Emailing in CakePHP

Change

App::uses('AppController','Controller','CakeEmail','Network/Email');p
.
.
.
public function signUp(){ # ... the rest of your code

to

App::uses('AppController','Controller');
App::uses('CakeEmail','Network/Email');

public function signUp(){ # ... the rest of your code

Source

static App::uses(string $class, string $package)

Classes are lazily loaded in CakePHP, however before the autoloader can find your classes you need to tell App, where it can find the files. By telling App which package a class can be found in, it can properly locate the file and load it the first time a class is used.

Some examples:

App::uses('PostsController', 'Controller');
App::uses('AuthComponent', 'Controller/Component');
App::uses('MyModel', 'Model');

So basically the second param should simply match the folder path of the class file in core or app.


Ps. give Mark some credits. I didn't notice that the answer was already given in the comments.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.