![]() |
DMZ 1.7.1 (DataMapper OverZealous Edition) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: DMZ 1.7.1 (DataMapper OverZealous Edition) (/showthread.php?tid=28550) |
DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-26-2010 [eluser]MelloMike[/eluser] Hi matyhaty! Thanks for the quick reply.. I had to change get() to get_iterated() and it worked... only problem is that it's just returning all the images but not actually associating them with the correct model. so I can't use something like this after I use that code.. Code: foreach($u as $user) The above will return ALL the images for every profile inside of the first $user->profile->all_to_array(); ... the rest will be empty. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-26-2010 [eluser]anaxamaxan[/eluser] @MelloMike I made that mistake with include_related too, but include_related and deep relationships only work along one-to-one relationships. You'll need to call get() on each Profile instance to access the related images. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-26-2010 [eluser]MelloMike[/eluser] [quote author="anaxamaxan" date="1293413183"]@MelloMike I made that mistake with include_related too, but include_related and deep relationships only work along one-to-one relationships. You'll need to call get() on each Profile instance to access the related images.[/quote] Awwww, thats a bummer.. but thanks. At least I know what I have to do now. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-26-2010 [eluser]WanWizard[/eluser] Having include_related() work on has_many is on the todo list, but it won't be in time for the next release (due in the next couple of days). DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-27-2010 [eluser]Haqqi[/eluser] Update: Sorry, my fault. I should use update() method instead of save(). I downloaded latest source of DataMapper from Bitbucket. What I want to ask is how to ignore created and updated field? Because not all my tables have created and updated fields. If i just try to write: Code: $opt = new Option(); I got an error that DataMapper try to update "updated" field. I have changed the config item "updated_field" to "null", but it seems that DataMapper use default "updated" as the name of the field. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-29-2010 [eluser]WanWizard[/eluser] Should work with save() as well. I've found the problem, I'll update it on bitbucket later today. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-30-2010 [eluser]Guido Mallee[/eluser] Hi, I'm new to DMZ but finding some trouble combining DMZ with the structure I use to mantain in my databases. That's because I add an 'active' field to every table in my DB. When I want to delete a record from a table, I never really delete it, but set the active field of that record to FALSE. I know this method has it's advantages and disadvantages, but so far I've never regret that I started using this consequently. Of course it's possible to keep using this method in DMZ, though i would like this to be applied by default on methods like get() and delete(). Will I have to write my own extension or will I be reinventing the wheel? Many thanks! DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-31-2010 [eluser]WanWizard[/eluser] Datamapper is just a class, and as such, it can be extended. Overload the get() and delete() methods to deal with your active field. For get(), you could just include a where clause including 'active', delete should require more attention as it deals with deleting relationships as well. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-31-2010 [eluser]Guido Mallee[/eluser] Thanks! I'll dig in to that then.. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 12-31-2010 [eluser]Guido Mallee[/eluser] Something else: I'm busy porting one of my CI projects to work with DataMapper. Seemed to be going fine untill i got this php error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40961 bytes) in C:\xampp\htdocs\spzw\system\core\Loader.php on line 665 Also when I output my $data variable, that I pass to my view, with FirePHP, it seems to be huge (lot's of data I do not use)! And of course, the page loads very slow (ending up with the above error). Is there a commonly made mistake that could cause DataMapper use so much memory? Thanks! |