[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]mrtavo[/eluser]
Greetings, I have a question that I can't resolve through the user guide. If I do a query like this ... SELECT <fields> FROM <table> LEFT JOIN <tableX> as <X> . . . WHERE (Case logic 1) AND (Case Logic 2) AND ( (Case Logic 3) OR (Case Logic 4) ) It should be something like: $ variable = new Model (); $ variable-> where_related_ ( 'Model2', 'field', 'value'); // case logic 1 $ variable-> where_related_ ( 'model3', 'field', 'value'); // case logic 2 . . . How do I add this? AND ( (Case Logic 3) OR (Case Logic 4) ) Should be a subquery? The truth is that I haven't got this very clear.
[eluser]mrtavo[/eluser]
Sorry, I reply myself, I had not seen the ability to group consultations. Sorry for the inconvenience.
[eluser]cube1893[/eluser]
Hi guys, I'm experiencing unexpected results when using a many-to-many relationship on my Application and Course tables. The process of adding elements works perfectly, but when the relationship gets updated, the old relationships remain in the table apllication_course. Example: 1. These are the relationships after an application has been created. Code: application_id | course_id 2. After that, a new course with id 55 is assigned to the application, all other course_ids should be deleted. But the result ist: Code: application_id | course_id and should be: Code: application_id | course_id How can I accomplish this? I'd appreciate any help!
[eluser]Mirage[/eluser]
You'll have to delete existing courses first before assigning new ones.
[eluser]cube1893[/eluser]
How can I delete these courses? I don't want to delete the courses but the relationships between an application and different courses.
[eluser]cahva[/eluser]
EDIT: Quote:Resolved. Duh! What a moron I'am Hi, I have a problem saving relation addressbook->country. Theres 3 tables, customers, addressbooks and countries. Customer can have several addressbooks, addressbooks can have single country. Problem is now that when I have 2 addressbooks and try to save the same country to both of them, other one gets wiped out! First heres the update that DMZ is doing: Quote:UPDATE `addressbooks` SET `country_id` = NULL WHERE `addressbooks`.`country_id` = 72 AND `addressbooks`.`id` <> '1'(so apparently it is first setting all addressbooks country_id to NULL with the same country_id) And the code: Code: if ($this->input->post('save_address')) Addressbook and country are related to eachother with $has_one. I know how to circumvent the problem(set the country_id manually when saving address) but I'm sure there is something Im missing here ![]()
[eluser]Michael Ditto[/eluser]
Minor documentation request-- there's a lot of power in the included extensions, and I find myself RTFM'ing them a lot. It would be nice to see those listed in the table of contents under a section to make them easier to find, rather than having them just linked from the "Included extensions" item of the "extending DataMapper" section. My carpal tunnel wrist would bless you a thousand different ways for the reduced mouse clickage. :-)
[eluser]Michael Ditto[/eluser]
[quote author="OverZealous" date="1261060868"]@chadbob Oh, yeah, the function-based tools vs object-based tools is very difficult to get used to. What's bizarre, though, is that I still enjoy coding in PHP more than in Java. Even with better debugging tools, stricter (and easier to read) code in Java, PHP is just more fun to write. :-P A good IDE helps. I'm still struggling along with Aptana 1.5 (2.0 effectively dropped PHP support > ![]() However, NB doesn't have a usable synchronizing toolkit, nor the ability to run command-line functions from the toolbar. I'm 75% of the way solving the first one, as I have written my own, developer-friendly standalone sync tool (in Java) that can be completely run from the command line or pop-up a GUI as needed, and stores sync properties in text files. Currently it syncs between any combination of local filesystem and SFTP (SSH+FTP) connections. I'll eventually release it to the world. The second problem is a much bigger issue, since I currently have a bunch of little utilities I run in Aptana, like JavaScript compressing. Until I solve that, I can't really switch away from Aptana.[/quote] I've settled on Komodo IDE, which is the only IDE I could get to reliably work with a remote debugger (XDebug). I think it has most of the things you're looking for. And it's fast (written in the Mozilla XUL framework I believe). For synchronizing I use Unison. It's really quite slick, and sounds like what you're doing. I think Komodo has some stuff but I have Unison set up to sync the log files back to my local machine so I can use the Mac's Console.app to view them as I debug, so it makes sense to have Unison take care of synchronizing the code base as well.
[eluser]OverZealous[/eluser]
[quote author="cube1893" date="1261087765"]How can I delete these courses? I don't want to delete the courses but the relationships between an application and different courses.[/quote] Use delete($related). It does not delete the objects in this format, just the relationship. |
Welcome Guest, Not a member yet? Register Sign In |