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

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

eZ debug

Timing: Jan 19 2025 01:10:25
Script start
Timing: Jan 19 2025 01:10:25
Module start 'layout'
Timing: Jan 19 2025 01:10:25
Module start 'content'
Timing: Jan 19 2025 01:10:25
Module end 'content'
Timing: Jan 19 2025 01:10:25
Script end

Main resources:

Total runtime0.9239 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 589.2891152.6406
Module start 'layout' 0.00500.0028 741.929739.4766
Module start 'content' 0.00770.9144 781.4063600.1641
Module end 'content' 0.92210.0017 1,381.570312.1250
Script end 0.9238  1,393.6953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3402160.0002
Check MTime0.00130.1444160.0001
Mysql Total
Database connection0.00070.080910.0007
Mysqli_queries0.864493.5647620.0139
Looping result0.00060.0656600.0000
Template Total0.892396.620.4462
Template load0.00200.212320.0010
Template processing0.890396.372320.4452
Template load and register function0.00030.029310.0003
states
state_id_array0.00100.105410.0010
state_identifier_array0.00080.081320.0004
Override
Cache load0.00170.1820410.0000
Sytem overhead
Fetch class attribute can translate value0.00090.100830.0003
Fetch class attribute name0.00160.171960.0003
XML
Image XML parsing0.00130.143330.0004
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00120.1252220.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs