[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
[quote author="silvergear99" date="1262633590"]This is odd. If validation fails on contact_name and the error message is echod. Yet it still save the username. [/quote] Uh, that's because I sent you a bad example. The second error message is printing whenever $success is FALSE. The code should look more like this: Code: // .. snip ... Alternatively, you could not report an error, and just check the error properties on $user and $user->contact after the fact. (These should be filled with the reason why the save failed.) Also, you shouldn't need to have more than one transaction. The PHP method to connect to the database should always return the same DB handle, so the transaction is global. You can start and end the transaction on any object, and all internal transactions are committed or rolled back at once. Because transactions can be expensive, you should only create the minimum needed. (You can, however, nest transactions if you need.) Finally, I didn't mention this before, but transactions require a specific table type if you are using MySQL. Pretty much all other common databases support transactions out-of-the-box. |
Welcome Guest, Not a member yet? Register Sign In |