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.