Re: [symfony-users] Re: how to prevent save in preInsert?

2010-05-29 Thread Georg Gell
add this to each form's configure() method, that you want to have flood protected (I expect that you want to protect this way (form) of entering data from flooding, and not the model itself): $this-validatorSchema-setPostValidator(new CombValidator(null, array(), array('invalid' = 'Flooding is

[symfony-users] Re: how to prevent save in preInsert?

2010-05-28 Thread Tom Ptacnik
If you want to redirect back to the filled form when user don't wait enough, then I think the best solution would be to do this validation in the moment as classic validation of the form fields. I suggest to create some class for this validation ... FloodProtector.class.php then create some

[symfony-users] Re: how to prevent save in preInsert?

2010-05-28 Thread comb
Hey Thanks! Yeah it's more clean like you describe to do it in processForm or the isValid for the form classes, but then I have to add this validation to each model-actions-class/model-form, that I want to be flood-protected. Isn't there a way to prevent code- duplication by using the preInsert

[symfony-users] Re: how to prevent save in preInsert?

2010-05-27 Thread Robert Schoenthal
he, try to return false in your preInsert Method, it think it should work On May 27, 12:39 am, comb sa...@gmx.net wrote: Hi, i'm writing a CheckFloodable-Behavior. Before a new record is saved, I would like to prevent the insertion of the new record if the user did not wait long enough.

[symfony-users] Re: how to prevent save in preInsert?

2010-05-27 Thread comb
Hey thanks, but it does not work :-( class FloodCheckListener extends Doctrine_Record_Listener { //... public function preInsert(Doctrine_Event $event) { return false; } } The record is saved anyway. On 27 Mai, 16:26, Robert Schoenthal

Re: [symfony-users] Re: how to prevent save in preInsert?

2010-05-27 Thread Daniel Lohse
http://www.doctrine-project.org/projects/orm/1.2/docs/manual/event-listeners/en#dql-hooks scroll down a little bit to the line: $event-skipOperation(); This should do what you want? Daniel On 27.05.2010, at 16:41, comb wrote: Hey thanks, but it does not work :-( class FloodCheckListener

[symfony-users] Re: how to prevent save in preInsert?

2010-05-27 Thread comb
that works! =) It prevent's the insert itself and I know, how to redirect back to the form, but I cannot figure out, how to display the given form values from the invoker again. My form is always empty :-/ class FloodCheckListener extends Doctrine_Record_Listener { //... public