Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Versionable + Validation
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
zampano  
View profile   Translate to Translated (View Original)
 More options 15 Oct, 11:09
From: zampano <d...@zampano.com>
Date: Thu, 15 Oct 2009 03:09:43 -0700 (PDT)
Local: Thurs 15 Oct 2009 11:09
Subject: Versionable + Validation
Hi Folks!

I have a problem with the integration of the Versionable behaviour.
Had a baseclass "Member", with some custom validation, i.e. just a
method to "pre"validate before submit.
One of the fields has minlength=4 .

When disabling the behaviour everything works fine.
But when enabling Versionable it shows me

"Validation failed in class MemberVersion 1 field had validation
error:
* 1 validator failed on password (minlength) "

Huh?

Another point is: the options of the behaviours are all documented but
not
for Versionable, so often one has to guess what the options are for.
Is there a documentation?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nino Martincevic  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 15:01
From: Nino Martincevic <d...@zampano.com>
Date: Thu, 05 Nov 2009 16:01:36 +0100
Local: Thurs 5 Nov 2009 15:01
Subject: Re: [doctrine-user] Versionable + Validation
Has anyone a solution or hint for this?
Otherwise couldn't use that feature, which would be very sad ...

Thx!

zampano schrieb:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Engeset  
View profile   Translate to Translated (View Original)
 More options 19 Nov, 20:23
From: David Engeset <froggy...@gmail.com>
Date: Thu, 19 Nov 2009 12:23:56 -0800 (PST)
Local: Thurs 19 Nov 2009 20:23
Subject: Re: Versionable + Validation
One solution that I have been able to come up with is to wrap the
isValid in a try and catch the Validator exception.  Example:

try {
  $rec->isValid();

} # end try

catch (Doctrine_Validator_Exception $e) {
  # Process all the invalid records encountered.
  foreach ($e->getInvalidRecords() as $rec) {
    foreach ($rec->getErrorStack() as $fld => $rulefailedon) {
      # Process the invalid fields encountered for the record.
      ...
    } # end foreach
  } # end foreach

} # end catch

But to determine the root cause I traced through the source to try to
determine the reason isValid throws an exception and it is because in
the preUpdate call in Listener.php for AuditLog it attempts to save
the version record without any try/catch around it.  It does the
saving of the version record prior to saving the final record.  So a
solution to this is to replace the save() call with a saveTry() since
if it fails the saving of the live version will fail too since they
use the same validation rules.
I hope this helps.

On Nov 5, 7:01 am, Nino Martincevic <d...@zampano.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A.J. Brown  
View profile   Translate to Translated (View Original)
 More options 19 Nov, 22:23
From: "A.J. Brown" <a...@ajbrown.org>
Date: Thu, 19 Nov 2009 17:23:39 -0500
Local: Thurs 19 Nov 2009 22:23
Subject: Re: [doctrine-user] Re: Versionable + Validation
Have you tried using the built-in validation methods instead of your
custom validaiton?

http://www.doctrine-project.org/documentation/manual/1_1/en/data-vali...

--
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Engeset  
View profile   Translate to Translated (View Original)
 More options 19 Nov, 22:49
From: David Engeset <froggy...@gmail.com>
Date: Thu, 19 Nov 2009 14:49:15 -0800 (PST)
Local: Thurs 19 Nov 2009 22:49
Subject: Re: Versionable + Validation
My understanding of the original post is they did use the built-in min
length validator and that works fine but the issue is an exception is
thrown when you call isValid which should not happen.

On Nov 19, 2:23 pm, "A.J. Brown" <a...@ajbrown.org> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nino Martincevic  
View profile   Translate to Translated (View Original)
 More options 24 Nov, 17:51
From: Nino Martincevic <d...@zampano.com>
Date: Tue, 24 Nov 2009 18:51:59 +0100
Local: Tues 24 Nov 2009 17:51
Subject: Re: [doctrine-user] Re: Versionable + Validation
Hi David et al.,

David Engeset wrote:
> My understanding of the original post is they did use the built-in min
> length validator and that works fine but the issue is an exception is
> thrown when you call isValid which should not happen.

Yes, that's right.

Thanks for your workaround.
But what I ask myself, am I the only one using that feature?
I don't think what I'm doing here is very exoctic, is it?

And the second part of my question was if there is a doc/faq/blog-entry
for versionable options.

Thx!


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Engeset  
View profile   Translate to Translated (View Original)
 More options 24 Nov, 20:52
From: David Engeset <froggy...@gmail.com>
Date: Tue, 24 Nov 2009 12:52:03 -0800 (PST)
Local: Tues 24 Nov 2009 20:52
Subject: Re: Versionable + Validation
I agree that what you are trying to do is not exotic as I am looking
to do the same thing.  I opened a bug report on the issue and per Jon
Wage's question back to me I think a proper work around for now is to
call isValid with the parameters (false, false) which the key is the
second parameter which tells it to not call any preUpdate or the like
hooks, otherwise as I discovered calling isValid will cause
Versionable to create a new version record, if no error is
encountered, before a save is done.  As for documentation the only
information I could find on the parameters was to look at the
Versionable class itself and see the options array and decipher from
that what you want to do.
I hope that helps.

On Nov 24, 9:51 am, Nino Martincevic <d...@zampano.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google