Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Extending Orm package
ZaicoPHP
November 2012
Is it possible to extend the Orm package from another package and that this replaces the one from Orm?
I've created a new package MyOrm with the following code:
----------
[packages\myorm\bootstrap.php]
\Package::load('orm');
Autoloader::add_core_namespace('MyOrm', true);
Autoloader::add_classes(array(
'MyOrm\\Model' => __DIR__ . DS . 'classes' . DS . 'model.php',
));
----------
[packages\myorm\model.php]
namespace MyOrm;
class Model extends \Orm\Model
{
static function test()
{
die('test');
}
}
---------
Then a model is added extending \Orm\Model (I don't want that Model_Test extends \MyOrm\Model):
----------
[app\classes\model\test.php]
class Model_Test extends \Orm\Model
{
}
The MyOrm package is loaded and now I would like to call Model_Test::test(), but this does not work. What is missing here?
Harro
November 2012
Accepted Answer
No, that is not possible.
*deleted user*
November 2012
You'd have to extend your package
[app\classes\model\test.php]
class Model_Test extends \MyOrm\Orm\Model
{
}
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
*deleted user*
November 2012
Harro
November 2012