Множественное наследование PHP

Я пытаюсь наследовать несколько классов друг от друга, но где-то что-то не так. Классы следующие:

Часть класса MobilInterface:

class MobileInterface
{

private $config;

private $errorData;

private $data;

private $output;

private $job;

public $dbLink;

public function __construct($config) {
    $this->config = $config;
}

public function initialize($job) {
    $this->dbLink = $this->createDbInstance($this->config);
    require_once 'jobs/' . strtolower($this->config->joblist[$job]) .'.php';
    $this->job = new $this->config->joblist[$job]($this);               
}

public function run($params) {
    $job = $this->job;
    $this->data = $this->job->run($_GET);

}
 }

Mobil Interface - это основной интерфейс, который вызывает класс Kupon на основе строки в $config. Моя проблема в том, что я хочу больше классов, подобных Купону, и хочу, чтобы класс BaseJob мог писать каждый класс Job без конструктора.

Проблема в том, что класс Купона не может видеть переменные $dbLink и $config.

Класс BaseJob:

 <?php
class BaseJob
{

public $interface;

public $dbLink;

public $config;

public function __construct(MobileInterface $interface) {
    $this->interface = $interface;
    $this->config = $this->interface->get('config');
    $this->dbLink = $this->interface->get('dbLink');
}

}
?>

И класс Купон:

function __construct(){
    parent::__construct(MobileInterface $interface);
}
}
?>

0 ответов

Другие вопросы по тегам