Challenge: Uniqueness at an asttribute's value

Author Message

Jorge estévez

Wednesday 24 September 2008 8:58:58 am

Hi to all,

I need to have an attribute of a class to be unique in it's value in the administration site.

My site has many products each with a unique code, at the admin site I would like to let other introduce instances of the product class but when inserting the code value they shoúld get an error if the code has been already entered (when they press the acept button send for publication)

The only idea I have is to have the attribute to be unique at the database and get the error when trying to insert the information but this does not seems the right thing to do... (messing with the database)

Uniqueness at the code attr. is needed whe inserting data in de admin site, this is a must.

thanks fot new ideas!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Piotrek Karaś

Wednesday 24 September 2008 9:52:30 am

Hi Jorge,

Try this, one of my first ones ;)
http://ez.no/developer/contribs/datatypes/ez_unique_datatypes

Good luck,
Piotrek

--
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

Jorge estévez

Wednesday 24 September 2008 10:04:16 am

Thanks

I am using ez 310, and the extension is meant for 4.X

is there some way I could use it for 3.10

thanks again!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Piotrek Karaś

Wednesday 24 September 2008 10:13:24 am

Yup, upgrade as soon as possible ;)

And if that's impossible, I don't remember exactly, but I don't think there is any advanced object-oriented PHP code inside, so it should be quite moveable backwards with little effort. I don't plan anything like that, though ;)

--
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

Jorge estévez

Sunday 28 September 2008 3:14:59 am

I will change the code...

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Friday 03 October 2008 3:54:51 am

Hi again,

Sorry to bother, the only thing I cannot find how to "traslate" to php4 are codes in the following form:

return eZInputValidator::STATE_INVALID;
return self::validateUniqueStringHTTPInput( $data, $contentObjectAttribute );
eZDataType::register( eZUniqueStringType::DATA_TYPE_STRING, "eZUniqueStringType" );

Can you spare 3 minutes please and transfrom the lines that has "::" to whatever php4 needs.

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Piotrek Karaś

Friday 03 October 2008 11:47:59 am

return eZInputValidator::STATE_INVALID;
eZDataType::register( eZUniqueStringType::DATA_TYPE_STRING, "eZUniqueStringType" );

These two you should be able to look up in any built-in datatype of 3.x, and those are located in /kernel/classes/datatypes/...

return self::validateUniqueStringHTTPInput( $data, $contentObjectAttribute );

This should work in both versions, you may try to substitute self:: with proper class name.

Sorry, but I've never written PHP for 3.x...

--
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

Jorge estévez

Tuesday 07 October 2008 4:36:43 am

Hello

Just can't find the right traslation to php 4.x code for ez 3.10, if someone could help with this, i does not seem so difficult but my lack of knowledge with php wont get me the results expected (be able to use it with ez 3.10)

any help will make my day, week and month!

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.