eZ Community » Forums » Developer » workflow content / publish / after
expandshrink

workflow content / publish / after

workflow content / publish / after

Friday 09 December 2011 3:35:06 pm - 7 replies

Hi,

We are developing a workflow called after content is published. In the function execute($process, $event){} method, we can access the objectID, but the nodeID does not exist in database. If the workflow is executed after publication, why the nodeID does not exist in the event?

Thanks for your help,

Friday 09 December 2011 4:24:30 pm

Hello Jean-Luc,

It's cool your learning more about workflow event creation, it is a great system to use, very helpful.

Remember that workflow events a specific to content object publishing and (to my knowledge are not involved with the content tree node aspects).

Think about it this way content objects (as represented by nodes (today)) will only -ever- have one parent nodeID (one main node), but only one, we call this the main_node in ezcontentobject class objects (read this class to learn more).

Now I know everyone prolly got up in arms about the above statement but in practice it's really quite true. 

Yes, you -can- have additional -locations- but these secondary locations are quite different from the main node (as you can only ever have one main node)

With regards to workflow events (and the parameters provided) you only need the objectID in order to know / use the content object main node, IE: $contentObject->attribute( 'main_node' ); in a workflow event gives your the primary node object (of class ezcontenttreenode). So in reality .. you simply do not need the workflow to know about or provide the nodeID as it is not required (at all), the content object itself provides all you need to reach most common use case goals.

 

I hope this helps ...

Cheers,

Heath

Friday 09 December 2011 4:40:31 pm

Hi Heath,

Thanks for your answer. To clarify, in my event code (function execute()...), I can get the nodeID (as main_node_id, there is no multiple locations in our project), but it is not appearing in the database.

My question is, when saying "content after publish", at this point (function execute()...), is the new line is created in the ezcontentobjecttree table?

Thanks again,

Friday 09 December 2011 11:04:06 pm

hey Jean-Luc,

$node = eZContentObjectTreeNode::findMainNode( $objectID, true );
$dataMap = $node->dataMap();

u're welcome in irc #ezpublish on freenode server

Modified on Friday 09 December 2011 11:04:30 pm by scrieler _

Saturday 10 December 2011 12:23:18 am

Hello Jean-Luc,

 

My replies inline ...

 

Hi Heath,

Thanks for your answer. To clarify, in my event code (function execute()...), I can get the nodeID (as main_node_id, there is no multiple locations in our project), but it is not appearing in the database.

 

Your welcome. I'm here to serve. I'm pleased that you understand what I was trying to share. Also glad locations are not part of the issue here ... moving on ....

 

<snip />
My question is, when saying "content after publish", at this point (function execute()...), is the new line is created in the ezcontentobjecttree table?

Thanks again,

 

Yes. At this point in the process content module publish operation has completed and the node is available within the content tree at that very moment (if not you would not be able to run your workflow event you would have been redirected backwards not forwards).

Rest assured your node is most likely available to the workflow event and any other function which uses content from the content tree at the instant (the very moment) the 'content, publish, after' trigger fires (remember it only fires after the node is published, so if it wasn't available you would not have triggered the workflow event at all.

 

I hope this helps ...

 

Cheers,

Heath

Sunday 11 December 2011 7:12:27 pm

Hi guys,

Actually, this is a strange behaviour, more than a bad comprehension of what an event is, and has. I tried to create a small event on a personal 4.4 eZ Publish instance, and it worked well, the nodeID is in the DB, and is on the PHP code. The problem is with a 4.5 eZ Publish instance, where the nodeID is indeed on the PHP code, but still not in the DB...

Well, I think I'll search more about this weird behaviour this week, I will tell you the results.

Thanks again for your answers.

Modified on Monday 12 December 2011 9:36:42 am by Jean-Luc Nguyen

Tuesday 13 December 2011 3:32:25 am

Hello Jean-Luc,

 

It would seem very strange to me that a 'content, after, publish' trigger would be executed, thus executing your own custom workflow event IF the content object was not really published previously. Separate from the "node not in 'DB' issue".

 

Also the eZ Publish database schema can (at times, to others) be considered daunting task to master in it'self.

Questions

  1. How are you going about validating or confirming that the node truly does not exist in the 'DB'?
  2. How are you validating the node exists in PHP during the workflow event execution?
  3. Do you employ any form of content object publishing approval process?
  4. How are you fetching the content object in question, during your workflow event?
    1. The workflow event is provided object id and version but how you fetch is up to you. I just wonder if there is any difference between the objectID/version the workflow event is provided and the latest version of the same objectID (outside the execution of the workflow event).
  5. Also are you experiencing any other problems with node publishing which does not run workflow events?
    1. It seems like if you were having problems with node publishing regardless of workflow event you would be complaining a bit more loudly. Which just makes me think again that your accessing the related information inaccurately.

I would very much like to attempt to validate for myself in the same manor as yourself results like these ...

I think a better understanding of the answers to the above questions might help here ...

 

An approval process could in theory prevent execution of your workflow event until after the object is truly approved and subsequently published. Though in that kind of situation much like I have mentioned before, the workflow event would simply not be run.

 

I almost wonder if there is another factor at play here ...

I just don't think this is a release issue, it really feels like a usage issue / misunderstanding.

 

If you could share reproducible details on how you are specifically confirming that, "During the execution of the 'content, publish, after' trigger' an subsequent execution of a custom workflow event, which is provided normal workflow params and execution, from the ezcontentobject id provided to the workflow event, it's main node (ezcontenttreenode object) does not exist in the 'DB'." it would really help here to clarify in more accurate, understandable and more specifically re-producible way just what exactly is occurring in your installation. I think then we might really have a chance to help further. Cause I've never heard of such a thing offhand before.

 

I hope this helps ...

 

Cheers,

Heath

Tuesday 13 December 2011 5:28:00 pm

Hello Jean-Luc,

 

It would seem very strange to me that a 'content, after, publish' trigger would be executed, thus executing your own custom workflow event IF the content object was not really published previously. Separate from the "node not in 'DB' issue".

 

Also the eZ Publish database schema can (at times, to others) be considered daunting task to master in it'self.

Questions

  1. How are you going about validating or confirming that the node truly does not exist in the 'DB'?
  2. How are you validating the node exists in PHP during the workflow event execution?
  3. Do you employ any form of content object publishing approval process?
  4. How are you fetching the content object in question, during your workflow event?
    1. The workflow event is provided object id and version but how you fetch is up to you. I just wonder if there is any difference between the objectID/version the workflow event is provided and the latest version of the same objectID (outside the execution of the workflow event).
  5. Also are you experiencing any other problems with node publishing which does not run workflow events?
    1. It seems like if you were having problems with node publishing regardless of workflow event you would be complaining a bit more loudly. Which just makes me think again that your accessing the related information inaccurately.

I would very much like to attempt to validate for myself in the same manor as yourself results like these ...

I think a better understanding of the answers to the above questions might help here ...

 

An approval process could in theory prevent execution of your workflow event until after the object is truly approved and subsequently published. Though in that kind of situation much like I have mentioned before, the workflow event would simply not be run.

 

I almost wonder if there is another factor at play here ...

I just don't think this is a release issue, it really feels like a usage issue / misunderstanding.

 

If you could share reproducible details on how you are specifically confirming that, "During the execution of the 'content, publish, after' trigger' an subsequent execution of a custom workflow event, which is provided normal workflow params and execution, from the ezcontentobject id provided to the workflow event, it's main node (ezcontenttreenode object) does not exist in the 'DB'." it would really help here to clarify in more accurate, understandable and more specifically re-producible way just what exactly is occurring in your installation. I think then we might really have a chance to help further. Cause I've never heard of such a thing offhand before.

 

I hope this helps ...

 

Cheers,

Heath

Hi Heath,

First of all, thanks for your answers.

Second, to answer your questions, this is how I've done and test. With a 4.5 eZ Entreprise version & 4.4 Community version, I created a small workflow content / publish / after, based on http://share.ez.no/blogs/thiago-campos-viana/tip-the-minimum-workflow-event-extension.

This is how I get the objectID value : 

$parameters = $process->attribute( 'parameter_list' );
$objectID = $parameters['object_id'];
exit;

At this point, if I try to find the new line with this objectID on ezcontentobject_tree table, there is none. But we found another way to execute our code, with a redirectafterpublish redirection to a module.

Thanks again,

Cheers,

Jean-Luc.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from