[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]tdktank59[/eluser]
[quote author="cahva" date="1265077218"]@tdktank59 Hey I had a similar problem with my e-commerce shop just couple of days ago. I had a table called products and one field was "model". I was using where_related. I got quite "interesting" sql. I changed the field to model2 and which made things work again. Sorry OverZealous, didnt have the time to do a bug report because of deadline and I dont have the time right now give proper details. But tdktank59, I just wanted to inform you are not alone with the problem ![]() Awesome thanks man, I decided to just save it manualy... $object->model_id = $model->id; Either way it works, just not very elegant lol...
[eluser]OverZealous[/eluser]
@tdktank59, cahva I think the problem you are both having is that model is a DMZ keyword. You can't use it for an object's name, because this will always result in a string: Code: $my_model = $widget->model; It's impossible for DMZ to save it, because it relies on the fact that $this->{"model"} resolves into an object. It's just incorrect. I would change the name of the object before you get too much further in your application.
[eluser]Mirage[/eluser]
Something wrong with how DMZ (or CI???) opens database connections - I'm running out of connections when saving objects in a loop: Code: public function shuffle_questions($exam_id) Apparently a new db connection is established on every save() call for some reason. That doesn't seem right. A quick look at the log shows this: Code: DEBUG - 2010-02-03 11:44:45 --> Database Driver Class Initialized Help?
[eluser]TheJim[/eluser]
@Mirage In your DataMapper config file set: $config['db_params'] = FALSE; Then the database instance will be shared across your DataMapper objects. Of course, that turns off subqueries, but that's usually fine.
[eluser]OverZealous[/eluser]
@Mirage, TheJim If you set db_params to FALSE, you will not be able to use sub-queries or anything that relies on them (such as include_related_count). If possible, a better option is to make sure that your DataBase connection is configured for persistent connections, by having this in your CI database settings file: Code: $db[/*connection id*/]['pconnect'] = TRUE; If your database did not support persistent connections, either due to PHP's driver or the DB itself, then you would have to follow TheJim's suggestion. However, MySQL supports it, so it should work. Basically, even though DMZ is creating many db objects, there should only be a single database connection. If this does not work, then I need to find a way to release the database connection when it is not in use. (Alternatively, this goes back to the idea of not using CI's ActiveRecord any more, which would eliminate the problem in a different way.)
[eluser]ak_85[/eluser]
Code: Fatal error: Class name must be a valid object or a string in D:\aplikasi_coba_coba\www\simpeg\application\libraries\datamapper.php on line 1730 when i make my own pagination and routes. and segment array more then 5 And in my controller i write: Code: function index() can anyone help me...
[eluser]OverZealous[/eluser]
@ak_85 My guess is it is a similar error to this one in the troubleshooting section: you probably have two classes with the same name. DMZ does not reference the segments in any fashion.
[eluser]ak_85[/eluser]
i have solved the problem... i have field name <b>parent</b> in my database, when i change the field name there is no error.... thanks for the response...
[eluser]Devon Lambert[/eluser]
How does DMZ handle database tables that do not have "id" set as the primary key? Is there a way to change primary key for a model? What about unique foreign keys? (This one may not matter as much). Thanks :-) |
Welcome Guest, Not a member yet? Register Sign In |