Forums / Developer / Creating object from php files

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.

eZ debug

Timing: Jan 18 2025 18:26:38
Script start
Timing: Jan 18 2025 18:26:38
Module start 'content'
Timing: Jan 18 2025 18:26:39
Module end 'content'
Timing: Jan 18 2025 18:26:39
Script end

Main resources:

Total runtime0.8762 sec
Peak memory usage4,096.0000 KB
Database Queries216

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 587.7109180.8359
Module start 'content' 0.00690.7350 768.5469679.7813
Module end 'content' 0.74190.1342 1,448.3281340.4375
Script end 0.8761  1,788.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4598210.0002
Check MTime0.00150.1692210.0001
Mysql Total
Database connection0.00080.093610.0008
Mysqli_queries0.794690.68322160.0037
Looping result0.00230.26032140.0000
Template Total0.845996.520.4229
Template load0.00230.262320.0011
Template processing0.843596.271320.4218
Template load and register function0.00020.018810.0002
states
state_id_array0.00090.098010.0009
state_identifier_array0.00090.105420.0005
Override
Cache load0.00190.2221520.0000
Sytem overhead
Fetch class attribute can translate value0.00120.131650.0002
Fetch class attribute name0.00100.1198100.0001
XML
Image XML parsing0.00100.108950.0002
class_abstraction
Instantiating content class attribute0.00000.0017100.0000
General
dbfile0.00420.4747280.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 39
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs