AlexKupreev / jelly-mptt

An MPTT extension for Jelly modelling system for Kohana 3
http://kupreev.com
18 stars 3 forks source link

Argument 1 passed to Model_Product_Category::initialize() must be an instance of Jelly_Meta_MPTT, instance of Jelly_Meta given calling MPTT Model through with #1

Open zsoerenm opened 14 years ago

zsoerenm commented 14 years ago

Hello

I get this error Argument 1 passed to Model_Product_Category::initialize() must be an instance of Jelly_Meta_MPTT, instance of Jelly_Meta given when I load the MPTT model through the method with():

$products = Jelly::select('product')->with('product_category')->execute();

I temporarly solved the problem by preloading the Mptt model like that:

Jelly::factory('product_category');
$products = Jelly::select('product')->with('product_category')->execute();

Couldn't find a real solution. You probably have to overload another method in classes/jelly.php

AlexKupreev commented 14 years ago

Have you tried the last committed version http://github.com/AlexKupreev/jelly-mptt/commit/9be3d723fcfffb27cec18a1cfb0b5423d7872e0c ? It should fix that but in some ugly manner (and really it does that you did). I plan to rewrite Jelly_MPTT in true Jellish style so no hacks will be needed.

zsoerenm commented 14 years ago

Yes I have used your latest commit, but Jelly's with method directly calls Jelly::meta() and doesn't go through your Jelly::builder()

AlexKupreev commented 14 years ago

maybe position of jelly_mptt and jelly in modules list is that jelly's builder not overriden?

zsoerenm commented 14 years ago

it definitely gets overriden: 'jellymptt' => MODPATH.'jelly-mptt', 'jelly' => MODPATH.'jelly',

Here my Traceback: $products = Jelly::select('product')->with('product_category'); //here it gets triggered

MODPATH\jelly\classes\jelly\builder\core.php [ 563 ] : $meta = Jelly::meta($model); MODPATH\jelly\classes\jelly\core.php [ 152 ]: if ( ! Jelly::register($model)) MODPATH\jelly\classes\jelly\core.php [ 200 ]: call_user_func(array($class, 'initialize'), $meta); APPPATH\classes\model\product\category.php [ 10 ]: public static function initialize(Jelly_Meta_MPTT $meta)

AlexKupreev commented 14 years ago

I see..

Really I can recommend waiting for new jelly_mptt in true jellish style without any hacks. I cant point exact date because being heavily engaged, but as soon as possible it will. Before theat use pre-initialising with Jelly::factory() :(

zsoerenm commented 14 years ago

Alright, thanks for your hard work though, besides from that it is really a pleasure to work with this module =)

AlexKupreev commented 14 years ago

can you please test the new version of Jelly against this issue?