Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM model not working?
  • Hi guys, When I try the example from the docs regarding the ORM package, I get the following error: ErrorException [ 4096 ]: Argument 1 passed to Orm\Model::__construct() must be an array, none given My code is as simple as: $new = new Model_Article();
    $new->name = 'something';
    $new->save(); With this code in app/classes/model/article.php (copied straight from the docs) class Model_Article extends Orm\Model {}
  • This something that needs to be looked at. For the moment, just pass array() as parameter to work around this issue.
  • Apprently I didn't test it using new without input - the factory does accept it without args. It used to have a private constructor but after a rewrite there was no longer need to have the constructor inaccessible so shortly before RC1 release I made it public.
    $new = Model_Article::factory();
    

    Edit: btw if you get errors from documented use it should go directly into the bugtracker: http://dev.fuelphp.com
  • So "$new = Model_Article::factory();" is the recommended way of instantiating? Or is the 'bug' going to be fixed in a later version? Or is either method good?
  • Maybe this should have given a clue whether I consider this a something that needs fixing:
    Apprently I didn't test it using new without input

    Will be fixed by next release (RC2 or final) and in about 5 minutes in the repo. There's no prefered way, as with creating Views the factory is there for convenience.

Howdy, Stranger!

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

In this Discussion