Creating object from php files

Author Message

Jose Mourinho

Monday 19 November 2007 8:04:57 am

Is it possible to be created object and to assign nodes to them by using php scripts...
I want to insert information form a mysql database to objects( after that to nodes) in eZ publish system. I think that the direct sql commands to the eZ publish database will not be a good idea so I want to use some module or mechanism of eZ publish to insert the info to the eZ Publish database.

I want to use php scripts to create ez object and assign node to it.
I think I should use some parts of content module.

Could you give me some information and opinions.
10x all

Jose Mourinho

Monday 19 November 2007 9:22:35 am

I want to create via php script an article object and assign node to it.
If someone has some ideas please help.

10x all

Oliver Frommel

Monday 19 November 2007 10:46:22 am

take a look at /bin/php/ezcsvimport.php of the eZ installation. You can find some patterns on how to create content objects via PHP there. You might also want to take a look at the forum thread http://ez.no/developer/forum/developer/cli_script_slow where you can finde a code sample and some hints on better practices.

Best
Oliver

Jose Mourinho

Sunday 25 November 2007 2:08:39 am

To achieve publishing articles, is it possible to send INSERT queries direct to mysql?
And if it is possible where can i found these queries?

10x all

Heath

Sunday 25 November 2007 3:06:31 am

<i>@Jose</i>

Again. You will want to take further time to study and learn from the existing eZ Publish PHP API Documentation and available extensions instead of seeking a sql based solution.

<i>http://ezpedia.org/wiki/en/ez/creating_new_content_objects_with_php
http://pubsvn.ez.no/doxygen/trunk/html/classeZContentObjectTreeNode.html
http://ezpedia.org/wiki/en/ez/solution_using_ez_publish_doxygen_api_documentation</i>

Once you understand the eZ content object / content tree abstraction matches code (php classes) up to database independent solutions. *

Take the time, write test code, learn to create using existing extensions as examples of content objects within eZ Publish. Use the API.

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

Daniel Hoppe

Sunday 25 November 2007 4:54:19 am

In the beginning I also thought: direct SQL INSERTs are a maybe a good way for fast content migration.

So I activated the SQL debug output within the admin to understand how to created an article.

Whats this?
68 x eZMySQLDB::query for creating an article
67 x eZMySQLDB::query for saving an article
(ok, most of them are SELECTs ...)

...and I understand the reason for the API.

Daniel

Jose Mourinho

Sunday 25 November 2007 9:33:00 am

ez Publish is new for me and i have to spend more time with documentation.
But i found the log of queries to mysql - the general query log http://dev.mysql.com/doc/refman/5.0/en/query-log.html

It might be possible to saw the the sql statements for publishing of articles.

Daniel Hoppe

Sunday 25 November 2007 2:18:45 pm

possible != useful

Maybe you will get later difficulties with the data-integrity.
This type of problems costs you really much time.

Daniel

Jose Mourinho

Monday 26 November 2007 8:27:20 am

10x for the advices and the shared information.

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 18 2025 19:07:35
Script start
Timing: Jan 18 2025 19:07:35
Module start 'layout'
Timing: Jan 18 2025 19:07:35
Module start 'content'
Timing: Jan 18 2025 19:07:36
Module end 'content'
Timing: Jan 18 2025 19:07:36
Script end

Main resources:

Total runtime0.9844 sec
Peak memory usage4,096.0000 KB
Database Queries79

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 589.3438152.6250
Module start 'layout' 0.00730.0038 741.968839.4453
Module start 'content' 0.01110.9718 781.4141674.7031
Module end 'content' 0.98290.0015 1,456.117216.1641
Script end 0.9844  1,472.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3459160.0002
Check MTime0.00130.1292160.0001
Mysql Total
Database connection0.00130.133510.0013
Mysqli_queries0.915292.9726790.0116
Looping result0.00090.0921770.0000
Template Total0.952496.720.4762
Template load0.00190.196920.0010
Template processing0.950496.548020.4752
Template load and register function0.00020.015610.0002
states
state_id_array0.00100.106110.0010
state_identifier_array0.00170.176520.0009
Override
Cache load0.00170.1698520.0000
Sytem overhead
Fetch class attribute can translate value0.00100.098940.0002
Fetch class attribute name0.00180.1808100.0002
XML
Image XML parsing0.00090.089740.0002
class_abstraction
Instantiating content class attribute0.00000.0022100.0000
General
dbfile0.00080.0825170.0000
String conversion0.00000.000940.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
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 39
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs