![]() |
[Deprecated] DMZ 1.5.3 (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: [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) (/showthread.php?tid=18196) |
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-17-2009 [eluser]warrennz[/eluser] Thanks again Over Zealous And quite right, I have a validation rule setup like that for it. I did have a really strange problem with it however. If I entered nothing into the confirm_username input field, once the form was posted, it would take on the value of my username field. Only after I added a 'required' rule to the confirm_username rule did it work as one might expect. Dunno if that's a bug, my code, or my browser being silly with cache/cookies/session or whatever but yea. So not sure how I'm gonna get around that one in future ![]() Thanks again ![]() [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-17-2009 [eluser]OverZealous[/eluser] Not a bug. If you don't include 'required', and the field is empty, DataMapper doesn't process any rules — since many of the rules might fail on an empty field (like exact_length). However, if you do include 'required', when saving an object it might throw an error if that field is empty. This is mitigated on one rule only: 'matches'. DataMapper has a special provision to pre-fill in the other field if a field has the 'matches' rule. One way to avoid it (I have used) is to create a custom _required function just for the model that needs it. This method (if only used on one field) can simply return TRUE, or it can return TRUE by checking the passed in field: Code: // in User, for example [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-19-2009 [eluser]oddman[/eluser] [quote author="OverZealous.com" date="1241578970"]@NachoF And I wouldn't use RoR for real applications, either. ![]() ![]() My point is that not everyone wants an ORM, and CodeIgniter's optional ActiveRecord already handles a lot of what RoR makes so special.[/quote] Define "real application", because I can tell you right now that Rails powers some of the largest websites. Point of my post is, your framework of choice matters not, it's what you do with it. You could have the lightest framework in the world, but if you're not cacheing properly, your entire application will fall over once you hit 50+ requests/sec. Fyi, I helped build a site that serves millions of users/day, using RoR for Westfield Group. I've also done similar with Cake and CI - so it's not the framework that matters. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-19-2009 [eluser]OverZealous[/eluser] Good for you. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-19-2009 [eluser]oddman[/eluser] Well if you're going to slam frameworks, you need to back yourself boi ![]() [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-19-2009 [eluser]OverZealous[/eluser] Lighten up, that original statement wasn't targeted personally at you. This is a forum about CI, not RoR. I don't have to back anything up, anyway, because I was giving my reason for choosing CI. For goodness sake, I followed it with a smiley. Please troll elsewhere ;-P [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-19-2009 [eluser]oddman[/eluser] Moving to PM ![]() [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-20-2009 [eluser]warrennz[/eluser] Help ![]() I have my user validation set like so Code: array( but it does not validation a match.. at all. The validation passes when the password field prams are met. Here's my controller Code: $u = new User(); Any ideas? Thanks [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-20-2009 [eluser]warrennz[/eluser] Double posting for the win ![]() I'm trying to extend DMZ. This is my datamapperext.php Code: /** This is my model Code: class Account extends DataMapperExt { My autoload config is loading 'datamapperext' I'm getting A Database Error Occurred Quote:Error Number: 1146 Something somewhere is going screwy with the table names etc. I'm really not sure Any ideas would be appreciated ![]() Thanks [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 05-20-2009 [eluser]OverZealous[/eluser] @warrnennz Second things first: Do not include the DataMapper model in the DME class. Simply create the DataMapperExt class as a model (NOT as a library). Load the DataMapper library like normal, through the autoloader (and do not load the DataMapperExt at all, as DataMapper will load DME automatically). Also, make sure you don't load any models, as DataMapper loads all of the models automatically, and including anything in the models will just duplicate the loading of classes (and, possibly, cause bugs). You should not get any errors with DataMapper unless you try to instantiate DataMapperExt — which you also should never do. Also, this might help, but don't use parent: ![]() ![]() Code: function __construct() { This is how mine is, and I know it works without errors. The 'matches' problem: I don't know why you are having trouble with the example given. You might want to try doing some debugging first. The only difference between the example you gave and mine is that I include 'trim', and an 'encrypt' function (as recommended in the instructions). Also, as I said before, if you do not manually check for 'required' (and do not include the 'required' validation rule), the 'confirm_password' field will always pass when empty(). Please try to debug by adding some echo()s to the DataMapper validation code, to see what's going on. |