Forums / Developer / Issue while trying to insert data in EZP from XML

Issue while trying to insert data in EZP from XML

Author Message

Jeremy B.

Monday 05 May 2008 5:10:12 am

Hi there,

I'm having trouble with a PHP script that used to work for around 6 months.
I'm using EZP 3.9.2.

This cronjob reads XML file, and puts its content in the database.
For injecting content to my new object/updated object, i'm using many lines like :

$contentObjectAttributes['title']->setAttribute( 'data_text', $title );
$contentObjectAttributes['title']->store();

It all works correctly, but when i'm trying to publish my new object with :

include_once('lib/ezutils/classes/ezoperationhandler.php');
$operationResult = eZOperationHandler::execute('content', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $object->attribute('current_version' ) ) ); 

i am having a <i>"Fatal error: A database transaction in eZ publish failed."</i>

Does someone had the same problem ? Can someone help me ?
Does this error has nothing to do with SQL mode STRICT_TRANS_TABLE ?

Many thanks in advance.

Piotrek Karaƛ

Monday 05 May 2008 11:39:17 am

This is just a pure guess, cause I have never touched that part directly, but maybe this would be a hint. This transaction error seems like a common message also for situations, when you try to carry out an operation that would clearly violate database rules, for example reinsert the same value for a primary key or a unique key. Now, looking at your example, this could be happening (knowing that publication should always create a new version)... I would inspect all the operations to see what is happening, and compare that to the db table state...

include_once('lib/ezutils/classes/ezoperationhandler.php');
$operationResult = eZOperationHandler::execute('content', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $object->attribute('current_version' ) ) ); 

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Jeremy B.

Monday 05 May 2008 3:28:49 pm

Thanks for your response Piotrek.

In fact, this was a misconfiguration in my site.ini file. Someone turned on "transactions" for SQL queries.

The entiere site work well, but the cronjob wasn't. I don't really understand why.

I'm done with it now =)