[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]Oblique[/eluser]
include_related_count deep relationship Code: $user->include_related_count('user_profile/driver', 'drivers') gives me Quote:Table 'DB.drivers_users' doesn't exist while i assumed that dmz would query user_profiles_drivers for that count what exactly do i not understand here? user guide says deep relations are available for this method
[eluser]chadbob[/eluser]
[quote author="The Hamburgler" date="1263493260"]Datamapper has made my job a breeze recently so I guess its time I gave something back! I've been working on my own CodeIgniter Table and Form libraries: GoodForm and BadTable, for a while now since most of my work is based around CMS web apps. Both libraries have been designed to work standalone but I have also included DMZ extension files to add their functionality to DM Models. If any one is interested please download a copy from my site and have a play... There will be bugs, but as i'm currently developing with both systems I should be able to provide fixes pretty quickly. PM me if you have any questions. Jim[/quote] This looks great, would you mind adding a simple sample with a basic model and generation/post? The documentation between the normal operation and the DMZ version seems disparate. Thanks!
[eluser]12vunion[/eluser]
[quote author="Oblique" date="1263923915"]include_related_count deep relationship Code: $user->include_related_count('user_profile/driver', 'drivers') gives me Quote:Table 'DB.drivers_users' doesn't exist while i assumed that dmz would query user_profiles_drivers for that count what exactly do i not understand here? user guide says deep relations are available for this method[/quote] It looks for table joins alphabetically. If you had two models, user_profile and driver, it would look for their tables (user_profiles, drivers) and combine them alphabetically to make a join table. Thus, your join table should be drivers_user_profiles. Table Naming Rules
[eluser]Oblique[/eluser]
@12vunion: looks like i posted too little data to concider: i have models user, user_profile, driver, all with tables properly named and everything else works fine. What does not work is counting deep relation I consider that DMZ is supposed to work like that here: Code: $user = new User($id);
[eluser]Jack Scott[/eluser]
DMZ 1.6.2 appears to mangle custom queries that contain data that looks like a table name. I have a section of code that looks up domain names from a database table using a custom WHERE clause. It looks something like: Code: $domain = 'www.my.example.com'; Datamapper mangles the WHERE clause into something that looks like: Code: WHERE `www`.`my`.`example`.`com` LIKE I have a similar problem in another section of code with a custom ORDER clause. It looks something like: Code: $ids = array(1, 5, 20, 3, 14, 16); This should produce an ORDER BY clause that looks like: Code: ORDER BY FIELD(properties.id, 1,5,20,3,14,16) But instead, I get: Code: ORDER BY FIELD(properties.id, `1`,`5`,`20`,`3`,`14`,`16`) Is there a way to turn off special processing in datamapper, or specify a query in a way that datamapper doesn't rewrite? Can the datamapper methods be updated to recognize when they're called with single arguments and turn off table rewriting?
[eluser]OverZealous[/eluser]
@Jack Scott DMZ uses CodeIgniter's ActiveRecord classes for handling the queries. It is CI that mangles queries. However, DMZ has new methods to help build functions with arguments without escaping. Please see SQL Functions in the manual for more information. You can also manually disable escaping setting the third parameter to FALSE, just like in ActiveRecord. @Oblique There's no way we can help you with so little information. My guess is that you have a misconfigured relationship. Why don't you take some time and look at the generated queries. See what the query looks like, and determine what it should look like. If we at least knew what was wrong, we might be able to help.
[eluser]Jack Scott[/eluser]
Thanks for your quick reply. Adding the extra field to where() fixed the issue I was having. The where() function now looks like: Code: $this->EE->rem4_domain->where("$domain LIKE CONCAT('%', REPLACE(name, '_', '\\_'))", NULL, FALSE); I'm using EE2 Public Beta on this project, so I ran into another unexpected interaction. CI as configured in EE2 uses a database table prefix, so it ends up rewriting the WHERE clause as: Code: WHERE 'www.my.exp_example.com' LIKE I didn't see an easy way around this, so I ended up writing the query manually using the query() method. I never could get order_by() to work for another query. My order_by statement looks like: Code: $ids = array(1, 5, 20, 3, 14, 16); No matter what I did, I couldn't get CI to leave the array of ids alone. I ended up writing a quick and dirty DMZ extension to handle order by field expressions, using some tricks I found in DMZ's source. The order_by statement is now much simpler. It looks like: Code: $this->property->order_by_field('properties.id', $ids); Here's the extension. It works for me, maybe it'll work for you. Code: <?php
[eluser]Muser[/eluser]
I am using the HTML Form extension in a medium/large project and saving some troubles I have got, I think it might be a wonderful extension. For me it is difficult to use DMZ without using this extension. If you decide to separate this extension from the DMZ latest version zip archive, please I think you should consider to include in the zip file an example of adding, editing and deleting objects and relations without using this extension, to become a best practice reference. If I am able to correct some bug for HTML Form extension I'll notify the community. Thank you! [quote author="OverZealous" date="1263490239"]To All: (Regarding the HTML Form extension) I understand that the HTML form extension is very useful to many people. However, I do not have the time to maintain it or support it. I would like to find someone who is willing to take over maintenance and support for this extension. It needs some work, and I just barely have enough time to keep up with the work on the core DMZ library. If you are interested in maintaining it, please let me know (either through a PM or right here). Just to be clear, everything I have for this extension is already included in the full DMZ download (including the documentation), so if you are interested, feel free to look at the source directly. I would be willing to include someone else's work with the full download, or pull the HTML extension out of the core download, and link to it somewhere else. The latter is probably preferable, since I won't necessarily upgrade DMZ on the same schedule as the HTML form extension.[/quote]
[eluser]cube1893[/eluser]
Hi guys, I want to use DMZ with transactions and tried to run the following code on a MySQL database with InnoDB: Code: $f = new File(); It's just for testing, but the rollback doesn't work! $config['auto_transaction'] is set to FALSE . Thanks for any help!
[eluser]OverZealous[/eluser]
You aren't testing the save() method. Are you sure the save is working correctly? Transactions have worked for many people. It is most likely a database problem. |
Welcome Guest, Not a member yet? Register Sign In |