PHP multiple-inheritance

570

I try to inherit multiple classes from each other, but something wrong happens somewhere. The classes are the following:

Part of the MobilInterface class:

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 is the main interface, which calls the Kupon class based on a string in the $config. My problem is that i want more Kupon like classes and wanted to make a BaseJob class to be able to write each Job class without the constructor.

The problem is that the Kupon class can't see the $dbLink and the $config variables.

The BaseJob class:

 <?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');
}

}
?>

And the Kupon class:

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

People are also looking for solutions to the problem: php - Prime numbers up to a certain number

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.