Forums / Developer / Creating an object through the eZ Publish API

Creating an object through the eZ Publish API

Author Message

Nicolas Steinmetz

Thursday 03 April 2008 6:10:48 am

Hello,

To ease our migration from our internal version of our eZ Publish projects, I would like to be able to create/alter objects through a script and not in the back office in a manual way.

So I would like to know if the API allows :
- to create new object
- to update object attributes (mainly add news ones for my current needs)
- if it's feasible, where can I find some code samples and documentation to implement this.

Regards,
Nicolas

Maxime Thomas

Tuesday 08 April 2008 11:39:17 pm

Hi,

You may use a one shot cronjob. In order to do that, you can look at :
- runcronjobs.php and the cronjobs directory files, to understand how to design your cronjob
- this article in ezpedia :

http://ezpedia.org/wiki/en/ez/cronjob
http://ezpedia.org/wiki/en/ez/creating_new_content_objects_with_php

Hope it helps.

Chears.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Ekkehard Dörre

Wednesday 09 April 2008 2:45:57 am

Hi Nicolas,

there are many examples in the http://ez.no/developer/contribs/import_export extensions. Or try to find an example here:
http://projects.ez.no/

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Nicolas Steinmetz

Wednesday 09 April 2008 3:45:53 am

Hi,

Thanks for the url.

Since my post, I could find the following one (for those who could also search for):

http://ez.no/developer/contribs/hacks/update_object_attributes

http://ez.no/developer/contribs/hacks/update_class_from_command_line

http://ezpedia.org/wiki/fr/ez/creating_new_content_objects_with_php

http://ezpedia.org/wiki/fr/ez/creating_new_content_object_versions_with_php

http://ezpedia.org/wiki/en/ez/import

but I had no time yet to dive into them.

Thanks for the link on the cronjob at is would save some time regarding the environnement initalisation.

For import/export contribs, I did not think about them this way. Thanks a lot too !

Regards,
Nicolas