![]() |
DMZ 1.7.1 (DataMapper OverZealous Edition) - 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: DMZ 1.7.1 (DataMapper OverZealous Edition) (/showthread.php?tid=28550) |
DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-03-2010 [eluser]backstack[/eluser] [quote author="OverZealous" date="1283575859"]@backstack You always need to first load the object before saving it. It also provides a nice safety net of verifying the input. Alternatively, look at the update method if you are simply updating one or more objects and don't need validation or verification. [/quote] I'm sorry, I didn't really phrase my question well enough I don't think. My problem is that, when I'm changing and saving on one variable (on my User model) (the 'activated' variable which corresponds to an 'activated' boolean column in the database, the validation for 'password_confirmation' is run (since I have the 'required' rule on it). This is problematic, since I just want to validate the 'activated' field (with the 'required' and 'boolean' rules) - I don't want the 'password_confirmation' rules running. Thanks for your help. ![]() DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-03-2010 [eluser]Atas[/eluser] [quote author="Lucas Alves" date="1283543391"]You have to set the "escape" to FALSE... $oObject->select("publicacion.*, IF(moneda_id > 1, pub_precio * 1, pub_precio / 3.9) as result", FALSE); I think this will solve you problem[/quote] Hi, i changed the "escape" value to FALSE but didn't work... if i use $oObject->get() to retrieve the data works fine, but if i use get_paged() doesn't work... i receive this error: Code: A Database Error Occurred The count query doesn't add the if statment... ![]() DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-04-2010 [eluser]Unknown[/eluser] First of all, thank you OverZealous for providing the excellent DMZ (and htmlform). For me they are super convenient and saves me a lot of work. One issue though, in the function "delete()" in "Datamapper.php" (beginning at line 1959 or so), I would appreciate if you would check the return values from $this->db->delete() and return FALSE if they fail. This gave me some problems with tables set up with foreign key constraints to prevent deletion. In my case, a delete operation of a row lead to this being intact (since the delete failed) and the relation key (_id) being set to NULL. Cheers DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-06-2010 [eluser]Lucas Alves[/eluser] @Atas I tested here and I got the same error as you. What's causing this is the Having clause, I don't know why it's changing the select statement... but if you remove the having clause it works well... DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-06-2010 [eluser]Lucas Alves[/eluser] @Atas I found the "problem"... actually, it isn't a problem, it's a performance question. See the comment in the get_paged method: // for performance, we clear out the select AND the order by statements, // since they aren't necessary and might slow down the query. I think it explain your question... ![]() DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-06-2010 [eluser]Atas[/eluser] @Lucas Thanks lucas!, i am going to change that adding a new param to get_paged() function and if that param get false will not clear out the select. Or another option is override get_paged() in this specific model, this option is more clean i think... DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-06-2010 [eluser]Lucas Alves[/eluser] I think override the function is better... But maybe there's a way to do what you need without change the method... DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-08-2010 [eluser]James McMurray[/eluser] Quick (hopefully) question: I've got a table where one of two values has to be non-null, while the other one must be null. It represents an image and the user can either upload it via the form or link directly to it. Is there a ways to set up a custom validation function that looks at two separate fields? DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-08-2010 [eluser]OverZealous[/eluser] Please see the included matches validation rule. But basically, you can easily configure a rule that does anything you want. To force validation, however, you'll probably need to add always_validate to your two fields. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 09-09-2010 [eluser]The Hamburgler[/eluser] I've got a question about datamapper and php's __autoload function. At the moment i have a call to __autoload() in config.php which allows me to have controllers extended from different classes. e.g. some extend Public_Controller and others extend Admin_Controller. The call to __autoload() enables me to automatically include these extended classes before the controllers are instantiated. I'm looking to do the same for models, I have a number of classes that extend the datamapper class and I want to have my models extend these classes rather than datamapper directly. At the moment, __autoload() is never called to preload the extended class when a model is instantiated so I get a Class not found error. I could add each of these classes to autoload.php but this seems inefficient. |