[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]bobosayhello[/eluser]
[quote author="NachoF" date="1266618956"]It doesnt require a join table... just for n to n relations[/quote] Thank you very much for pointing this out. I made a mistake. DMZ does not require a joining table for a 1:N relationship while it seems to be the case for the original version of DataMapper.
[eluser]BaRzO[/eluser]
@Conerck When I use with $c->region_name or $c->name it does not work. I have changed it like $city->region_name It's works but get only one region. Is it possible I don't know, the problem is the sql query maybe there is a LIMIT 1 for region Code: $regions = new Region();
[eluser]Conerck[/eluser]
[quote author="BaRzO" date="1266677821"]@Conerck When I use with $c->region_name or $c->name it does not work. I have changed it like $city->region_name It's works but get only one region. Is it possible I don't know, the problem is the sql query maybe there is a LIMIT 1 for region [/quote] It should be $r->name The $r variable holds the Region data. The $c variable holds the City data. The LIMIT 1 queries are not the problem. They are made by DMZ to find out what fields are in your tables. EDIT: You should also take a look at the Model-View-Controller-Pattern
[eluser]OverZealous[/eluser]
@BaRzO, Conerck I feel this is my fault. I need to stop that bad habit of using single-letter variables in example code! (I never would do it in production, so why do it in examples?) :-P Have a good weekend, everyone. I'll probably be polishing 1.7 this weekend, and I'll put out a beta release for a little while first, so everyone can see if I missed anything.
[eluser]Peet86[/eluser]
Hi Phil! I have a problem with DMZ 1.6.2.. I have two model: Media Post I try to join this way: $p->media... I get this error: Code: Unknown column 'mw_join_medias_posts.medium_id' in 'on clause' MEDIUM?? WTF? ![]() Can you help me? Peter
[eluser]OverZealous[/eluser]
@Peet86 It's the inflector helper, as described at the bottom of this page. It is automatically attempting to pluralize media[/]b to [b]medium. (Also, make sure you are using the updated Inflector helper provided with DMZ.) You just need to defined both $model='media' and $table='medias' in your model definition.
[eluser]Peet86[/eluser]
Thanks Phil! It works now! One more question: I have multiple relation between Media and Post.. The relations have "type" join field. Can I add some where() term for the join field when I delete? Code: $n = new Post(); Peter
[eluser]Mosselmaniac[/eluser]
Hello everybody, First post on the forum. I'm new to CodeIgniter. In fact, I'm planning to use a PHP framework for an upcoming project. CodeIgniter seems interesting at first glance, but I need an ORM to make life easier. That's why I came the "DataMapper OverZealous Edition". But before I commit myself into using these two projects, I have a question: Is it possible with this ORM to generate the objects from the database-definition? So, I define my tables in a structured way, I define my foreign keys (relationships), then I can imagine it would be possible to generate the models. (incl. getters / setters). That will gain me a huge amount of time. The other way around would be workable too, I code my models and call some kind of method that is generating the applicable database representation. For example, Author and Book have a many-to-many-relationship. I'm looking for something that automatically generates the join-table between the two. Or visa versa. I've looked into the user guide of both CI and DMZ. I tried to use the search-feature, but couldn't find any related questions. I'm probably wrong, because this looks like question number #1 to me ;-) Correct me if i'm wrong, any help is appreciated. Thank you in advance. |
Welcome Guest, Not a member yet? Register Sign In |