![]() |
DataMapper 1.6.0 - 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: DataMapper 1.6.0 (/showthread.php?tid=11358) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
DataMapper 1.6.0 - El Forum - 04-26-2009 [eluser]OverZealous[/eluser] @MeanStudios You can actually chain objects out, as far as you want: Code: $c = new Client(); Also, if you wanted to try DMZ, a drop-in replacement for DataMapper that adds a lot of features (if you are already using it, sorry, I get confused this late at night ;-) ), you can embed data one-level deep into a query: Code: // embed the state into the address Another option would be to relate the country directly to the address as well, which would make it possible to join both objects. DataMapper 1.6.0 - El Forum - 04-26-2009 [eluser]MeanStudios[/eluser] Nope, haven't heard of it till now ![]() Also, I'm going to give DMZ a try ![]() DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]nmac[/eluser] Hi, thanks for the help so far, making good progress with DMZ. I have a question though about getting a resultset based on a relation. Code: $t = new Tag(); Code: <!-- last query is showing me this... --> Am I missing something or doing something wrong? Thanks for any help. Cheers N. DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]OverZealous[/eluser] It should work just fine. A relationship query is really just a shortcut to looking up an item based on the parent item. I usually use get($limit, $offset), but I was going through my code to see if I used it exactly like you use it, and I find that in almost all cases I use: Code: $article = new Article(); However, I can't see why it would matter. Calling the query the way you are actually uses where_related under the surface, anyway. I suppose there could be a bug in using limit() instead of get($limit, $offset), but that doesn't make too much sense, since get($limit, $offset) calls limit() when looking up relationships. There just isn't anything I can see in the code to cause it. DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]OES[/eluser] Hi OverZealous Geetting a wiered SQL error and not sure on this one but hope you can advise. Im just doing a basic relationship call using your datamapper file so I have removed the relationship table and added the model_id within the first table. A simple call ie. Code: // Create new Object Very simple all models setup with correct one one and names etc. But the SQL error Im getting it. Code: Table 'tablename.stadia' doesn't exist Why is it trying to acces table name stadia ?? Just to confirm I have corrent has one relationships ie Code: // category model Any ideas ?? Hope you can advise DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]OES[/eluser] Ok I just found my issue. Ive added var $table = "stadiums"; Strange as I thought it added the s ?? Oh Well ! DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]OverZealous[/eluser] DataMapper uses a modified Inflector helper, which sometimes is a little too smart (ie: stadia is the greek-suffix pluralization of stadium), and sometimes not smart enough (ie: addres is not the singular form of addresses). That's the joy of English: it is amazingly flexible, and able to absorb words from languages around the world, but the rules are just as flexible! DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]NachoF[/eluser] [quote author="OverZealous.com" date="1240874349"]DataMapper uses a modified Inflector helper, which sometimes is a little too smart (ie: stadia is the greek-suffix pluralization of stadium), and sometimes not smart enough (ie: addres is not the singular form of addresses). That's the joy of English: it is amazingly flexible, and able to absorb words from languages around the world, but the rules are just as flexible![/quote] Thats weird, i thought it just added an 's' at the end.... especially considering my tables are actually in spanish (instead of events Im using eventos, instead of products Im using productos) and so far I've had not problems with table and model names. DataMapper 1.6.0 - El Forum - 04-27-2009 [eluser]nmac[/eluser] @phil (OverZealous), Thanks man, that worked a treat! N. DataMapper 1.6.0 - El Forum - 04-28-2009 [eluser]apersaud[/eluser] Hi @OverZealous, Great work on DMZ 1.2 . Is there a standard location for downloading the latest version of DMZ (maybe a CI wiki page?). It is getting a bit 'annoying' trying to find the right post on this thread with the latest DMZ everytime. :-) Thanks! |