![]() |
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 - 07-08-2012 [eluser]WanWizard[/eluser] [quote author="Jacob F." date="1341679090"]That's what I figured :/ Is that fk issue what's causing DataMapper to think there is a many-to-many relationship[/quote] Datamapper contains logic to see how the relationship is defined, as it supports join tables even for one-to-one relations. It does that by looking at the PK's and FK's in the relationship definition, and if they are not found in the related tables, assume you have a join table that contains the FK's. This is the case here, as the generated FK is wrong so it can't be found. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 07-08-2012 [eluser]Jacob F.[/eluser] Damn :/ Thanks for the insight! DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 07-08-2012 [eluser]Mark LaDoux[/eluser] Sorry to hear that you are dropping this. I'd take it over, but I neither have the time nor the skill. I love this library, and hope someone decent picks it up for you. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 07-08-2012 [eluser]WanWizard[/eluser] [quote author="Mark LaDoux" date="1341782265"]Sorry to hear that you are dropping this. I'd take it over, but I neither have the time nor the skill. I love this library, and hope someone decent picks it up for you.[/quote] Who is dropping what? I'm not dropping anything, I've only postponed development on 2.0 (which will be an entirely new codebase) until it's clear where CI 3 is heading... DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 07-09-2012 [eluser]Jacob F.[/eluser] I think there might be a bug in where_between(): it doesn't enclose dates with quotes (which causes the database to perform a mathematical operation): Code: # www.example.com/?range[0]=2012-07-04⦥[1]=2012-07-06 But Code: $orders->where_between('date',"'".$range[0]."'","'".$range[1]."'")->get(); Also, (string)$range[0] and "{$range[0]}" don't produce quoted strings. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 07-09-2012 [eluser]WanWizard[/eluser] Well spotted, and thanks for reporting it. Fixed: https://bitbucket.org/wanwizard/datamapper/changeset/00e9af373d9c If you're on 1.8.2, you can apply this fix to your version of Datamapper, or download the latest from bitbucket. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 07-09-2012 [eluser]Jacob F.[/eluser] Wow, that was fast--thanks! DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 04-23-2013 [eluser]BrainFeeder[/eluser] I have troubles getting/deleting related data when the tables are in different databases. Code: class Company extends DataMapper { Code: class User extends DataMapper { Now when I try to get the related company from a user like this: Code: ... I get the error : "Table does not exist". Datamapper looks for the users table in the database where the companies table is while I've set different db_params for both models. Did I forget something? Or doesn't datamapper support cross database joins? DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 04-24-2013 [eluser]cahva[/eluser] I have not tried cross database joins with datamapper but what SQL does it give you when you try this: Code: echo $u->company->get_sql(); DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 04-24-2013 [eluser]BrainFeeder[/eluser] It prints Code: SELECT * FROM (`tbl_companies`) Shouldn't there be a WHERE part ? If I do Code: $u->company->get(); I get the error: Code: A Database Error Occurred As you can see the format isn't database.table.field , just table.field |