Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Extending Orm package
  • 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?



  • HarroHarro
    Accepted Answer
    No, that is not possible.
  • You'd have to extend your package

    [app\classes\model\test.php]

    class Model_Test extends \MyOrm\Orm\Model
    {

    }

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion