Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorJCC
     
    Hi there,

    What is the correct way to override the constructor in Akelos for Models and Controllers?

    I've tried (model)

    function __construct()
    {
    parent::__construct(func_get_args());

    Ak::import("A");
    Ak::import("B");
    //etc
    }

    which fails with Fatal error: Call to a member function getAttributes() on a non-object in C:\Projects\akelos\trunk\lib\AkActiveRecord.php on line 295

    And

    function __construct()
    {
    parent::__construct();

    Ak::import("A");
    Ak::import("B");
    //etc
    }

    But this has issues with loading related objects. I.e. if a try to load x with $this->x-load() it just returns "AkAssociatedActiveRecord". The relationship is fine (it works when I comment out the contructor).

    Kind regards,

    John
    • CommentAuthorKaste
     

    call something like

        $attributes = (array)func_get_args();
        $this->init($attributes);