DMZ 1.7.1 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
@dejavu It's a good idea, but DMZ doesn't work that way. That parent relationship is stored on a variable called parent, and persists across queries. However, I think I may understand the problem for bee27: If there is a field called parent in the database, this will break the way DMZ works. @bee27: Make sure you aren't using any reserved names. See the red section for common problems.
[eluser]bee27[/eluser]
[quote author="OverZealous" date="1282107746"]@bee27: Make sure you aren't using any reserved names. See the red section for common problems.[/quote] @OverZealous thanks! I did take a look at that page, but obviously didn't thoroughly check my database field names and completely missed the fact I had a field in the Pages table called parent! I renamed it and it looks like its working fine now!
[eluser]kre8ivdesigns[/eluser]
I have been reading all the forums about Module Separation and DMZ and cannot understand what the correct answer is. Do they work together? And everytime I call a controller I get "Call to undefined method" File structure Application - config - controllers - datamapper - errors - helpers - hooks - language - libraries - models - modules -- welcome -- day --- controllers ---- day --- models ---- day --- views -- reservation --- controllers ---- reservations --- models ---- reservation --- views - views
[eluser]Lucas Alves[/eluser]
@kre8ivdesigns... Here's a thread about this: http://ellislab.com/forums/viewthread/154350/ He changed the autoload function to Datamapper look for models in the modules models folders... It worked to me, although I'm not using this cause I prefered to put all models into application/models folder, just to centralize all of them... I don't remember it clearly, but I think that this hack has a problem: when a model is in a module folder, you can access the model from the modules controllers, but you cant access them from controllers in the application folder.... I'm not sure about it...
[eluser]kre8ivdesigns[/eluser]
yeah i read that forum... I am trying things out and it seems to be working if I call $this->load->model('module_name/model') but I can no longer do $model = new Model() in a controller. I might just go back to putting all models into the application/models folder. THANKS
[eluser]WanWizard[/eluser]
I'm a bit stuck on advanced relationships. I thought I figured it out, but no matter what I do it keeps on creating queries using a non-existent pages_sites table... Situation: I've got a table 'sites', with the fields 'id', and 'template_id'. And I've a table 'pages' with the field 'tree_id'. My site model: Code: var $has_many = array( My page model: Code: var $has_one = array( This works without problems. I can delete a site, which also deletes all pages records that have the sites.id as pages.tree_id. Now I need to link site->template_id to page->tree_id, so that when I delete a site, it also deletes the pages records that have sites.template_id as pages.tree_id. * El Forum lost...
[eluser]Jfly[/eluser]
I had a problem with include_related_count. Code: A Database Error Occurred It seems like subquery is not working. $db_params is set to '' now, do I need to change it to something else? Thanks a lot.
[eluser]7amza[/eluser]
hey , i have a small problem . my database structure: portals(parent): id title created .. categories(child) : id portal_id title.. pages(child) : id portal_id title.. portal.php(model) : Code: <?php Code: <?php Code: <?php Quote:DataMapper Error: 'page' is not a valid parent relationship for Portal. Are your relationships configured correctly?i wrote the manual especially the item #4 that's try to solve the problem but i didn't get a solution .
[eluser]WanWizard[/eluser]
So Page and Portal have a many-to-many relationship. In that case you need a pages_portals table relationship table, containing the page_id and the portal_id. You now have defined a direct link from portal to page, which defines a one-to-many relation.
[eluser]WanWizard[/eluser]
@phil, Small question: is it correct that validation rules don't run on objects you fetch via include_related()? I have a table column which contains a serialized array. I've added a rule for that field unserializing it when it's read, and serializing it when it's written (and it's an array). This works file if I use the table object directly, but not if I include it from a related object. |
Welcome Guest, Not a member yet? Register Sign In |