Share » Forums » Developer » Check attributes before custom php...

Check attributes before custom php object creation

Check attributes before custom php object creation

Monday 29 November 2010 10:05:54 pm - 6 replies

Author Message

Jérôme Vieilledent

Tuesday 30 November 2010 12:53:55 am

Hi Paul

Unfortunately it does not seem to be possible at that time, because validation is only made by the content/edit module.

However, every datatype has a validateObjectAttributeHTTPInput() method, but as its name indicates it, it is based on HTTP. I guess you could fake it by using eZHTTPTool and provide fake POST variables, while this is not the cleanest thing I could advise...

Anyway, instead of using eZContentFunctions::createAndPublishObject(), you might want to use SQLIImport extension which contains a simplified content API. It does not allow (yet) to validate data, but this is an interesting idea :)

Paul Etienney

Tuesday 30 November 2010 1:17:02 am

Hello Jérôme.

Thanks for your reply. I guess you have a gazillion kilometers long todo list but it would great to be able to easily check attributes.

Meanwhile, i'll do it "manually".

Bye.

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Gaetano Giunta

Tuesday 30 November 2010 1:51:55 am

Having attribute validation decoupled from HTTP is imho one one of the most important advancements we need at this point in time in the eZP content model:

- it prevents creation of webservices / cli scripts / other APIS that create content without going through the monster that content/edit is

- it makes creation and validation of import scripts a chore. Almost every website I have audited where import scripts had been developed had some inconsistent data in the db

So I'd rather push to fix this in the kernel than add it to an extension...

Principal Consultant International Business
Member of the Community Project Board

Gaetano Giunta

Tuesday 30 November 2010 1:53:52 am

ps: this is also true for content imported via packages. Just test this: set an object-relation attribute as required in a class, create an obj, export it in a package (but omit its related obj), import it. You end up with an object that does not comply with your class spec...

Principal Consultant International Business
Member of the Community Project Board

Paul Etienney

Tuesday 30 November 2010 1:58:38 am

Hello Gaeano,

Good to hear that. I guess many people would love to check attributes easily.

Do you think it is a lot of work to fix this in the kernel ?

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Jérôme Vieilledent

Tuesday 30 November 2010 2:25:13 am

So I'd rather push to fix this in the kernel than add it to an extension...

Sure, this is also the case for the simplified content API btw ;).

The main advantage to add this into an extension is that you can have it now :). Besides, SQLIImport is compatible 4.1+

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu