Forums / Developer / Multiple attribute validation rules for custom datatypes

Multiple attribute validation rules for custom datatypes

Author Message

Piotrek Karaś

Thursday 20 December 2007 10:42:14 am

Does anyone have any experience with creating complex validation rules for their custom datatype, so that they actually access other attributes of the same object being edited/created and validate their values or even their combinations? For example, let's image a class attribute based on custom datatype, whose only purpose is to check whether value of two other attributes have certain presupposed values.

Is it even possible to reach out of the validateObjectAttributeHTTPInput method of datatype definition class towards other attributes? Or maybe should this be done at some other stage?

I'd be grateful for any pointers!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Heath

Thursday 20 December 2007 1:59:00 pm

Hello Piotrek,

I have seen contributions along similar topics. It might be useful to know if you have examined these existing contributions and if they meet your needs.

http://projects.ez.no/objectvalidation
http://projects.ez.no/bcicfv

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Piotrek Karaś

Thursday 20 December 2007 2:17:54 pm

Hi Heath,

Thanks for the tips - I actually forgot to look for solutions within the projects site.

Especially Kristof's objectvalidation seems interesting, but unfortunately it's not available for download... or maybe it is for logged in users, but I don't happen to have an account there... If you have one, could you please check it for me?

As for as my own investigation...

Even if I cannot perform validation on the object level, the attribute level and validation methods perfectly see POST variables, so there's a bit of possibilities there.

Also, one of the things that I may need is a change-protected text line or integer. Since I have to be 100% sure that it remains unchanged from the moment of object's creation through all the editing sessions, I was thinking about a datatype that would check a hash of the value and some unique data, for example: sha1($sessionID.$salt.$attributeValue.$contentObjectID). This should be difficult to skip and also to somehow forge. We'll see how it works, it's just a concept for now ;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Heath

Thursday 20 December 2007 2:29:33 pm

Hello Piotrek,

Ask Kristof for an account, I'm certain he would accommodate you with an account ;)

Still, you don't have to wait to have an account to checkout a copy of his extension! Simply use subversion to checkout the extension from the svn repository located at ...

<i>http://svn.projects.ez.no/objectvalidation/trunk/extension/objectvalidation/</i>

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Piotrek Karaś

Thursday 20 December 2007 2:34:56 pm

;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

eZ debug

Timing: Jan 20 2025 20:06:06
Script start
Timing: Jan 20 2025 20:06:06
Module start 'content'
Timing: Jan 20 2025 20:06:06
Module end 'content'
Timing: Jan 20 2025 20:06:06
Script end

Main resources:

Total runtime0.0216 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0085 587.9688180.7969
Module start 'content' 0.00850.0050 768.7656101.9766
Module end 'content' 0.01350.0080 870.742278.7031
Script end 0.0215  949.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00209.2527120.0002
Check MTime0.00104.4540120.0001
Mysql Total
Database connection0.00083.873110.0008
Mysqli_queries0.004922.919640.0012
Looping result0.00000.093920.0000
Template Total0.007735.810.0077
Template load0.00073.358510.0007
Template processing0.007032.393110.0070
Override
Cache load0.00052.283910.0005
General
dbfile0.003717.0497100.0004
String conversion0.00000.027630.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs