Hi,
I want to create an abstract class that will inherit from an
interface and then create two more classes that will inherit from this
abstract class. All of this files are in a subfolder ‘ExportSynthese’ in
the ‘Controller’ folder.
I managed to create all those classes but I’m still having the following error :
“Error: Interface ‘IExportSynthese’ not found”
My classes look like :
The abstract class :
<?php
abstract class ExportSyntheseController extends AppController implements IExportSynthese {
public function function1($arg) { // code }
public function function2($arg, $nextArg) { // code }
}
The interface :
interface IExportSynthese
{
public function function1($arg);
public function function2($arg, $nextArg);
}
The class that inherits from my abstract class :
<?php
App::import('Controller', 'ExportSynthese');
class ExportSyntheseSimpleController extends ExportSyntheseController {
public function function1($arg) { // code }
public function function2($arg, $nextArg) { // code }
public function test () { die('works'); }
}
I’ve tried to add the following imports (tried with App::import()
and App::uses), both in ExportSyntheseSimpleController and ExportSyntheseController :
App::import('Controller', 'IExportSynthese');
App::import('Interface', 'IExportSynthese');
App::import('ExportSynthese', 'IExportSynthese');
None of them worked and I’m still getting the error. Another thing
that I don’t understand is that when I try to reach the function test()
in
my ExportSyntheseSimpleController
, the address is :
app_name/app/Controller/ExportSynthese/ExportSyntheseController.php
So it looks like that it goes in my abstract class first and then in
the class that exports my abstract class. However, if my class ExportSyntheseSimpleController
stops extending ExportSyntheseController
but AppController
rather, then it works and I can access my test()
function
Thank you for your help, ask me if you have any questions.