Answer the question
In order to leave comments, you need to log in
How to implement library class extension?
The Kohana framework has the following class extension mechanism:
The main file containing the class code is kohana/classes/Kohana_Test.php:
<?php
class Kohana_Test
{
public function __construct()
{
echo 'kohana/classes/Kohana_Test.php';
}
}
class Test extends Kohana_Test {
public function __construct()
{
echo 'app/classes/Test.php';
}
}
class Test extends Kohana_Test
{
}
$obj = new Test; // 'app/classes/Test.php'
Answer the question
In order to leave comments, you need to log in
<?php
function autoload($class)
{
$prefix = 'Enso_';
$file = $class . '.php';
if (file_exists($file)) {
include $file;
} elseif (file_exists($prefix . $file)) {
include $prefix . $file;
class_alias($prefix . $class, $class);
} else {
return false;
}
}
spl_autoload_register('autoload');
$obj = new Abc;
$obj = new Test;
$obj = new Enso_Test;
The question is not entirely clear, if you don’t need to redefine or add anything, then why do you need dummies?
ZF2 is tied to ServiceManager, dependencies are obtained from it by key. Key values can be overridden in the application if you need it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question