This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Bug with trash in legacy workflow
expandshrink

Bug with trash in legacy workflow

Bug with trash in legacy workflow

Wednesday 05 February 2014 4:05:37 pm - 10 replies

I think I experienced some kind of bug, when trying to call a symfony service inside a legacy workflow.

I created an event that is triggered on "content publish after" and calls a custom symfony service to do some stuff and it worked incredibly fine for creating or updating elements.

But when restoring items from the trash, the workflow fails, with the exception Location with identifier "[someLocationId]" could not be found. I investigated and found out, that the location is not known in symfony and the corresponding trash item is still in trash, whereas a legacy fetch returns a valid node. (with published = true)

 This is my code in the event:

So then I tried to use the trashService to recover the item from the trash, but the outcome of this is a database error, which seems to be even worse.

 

Could someone please tell me, whether this is an ez bug or whether I've been doing something wrong? I'm near of despair.

Thursday 06 February 2014 1:13:41 am

Seems to indeed be some kind of bug, would help if you report this with the data you get from legacy, so setting thrid fetch argument ($asObject) to false and dumping the returned value should provide the exact data from the database which would help here.

Thursday 06 February 2014 9:04:53 am

Okay, here are my fetches:

And this is the output:

 

I hope it helps. Thank you in advance!

Thursday 06 February 2014 9:34:29 am

Could you expand a bit what you are doing around this?
Is for instance this inside a transaction? You mentioned it is inside workflow?

Reason for asking is that new and old stack does not share connection, new stack uses PDO and old stack uses mysqli, so if there is transaction involved and changes on going, that might explain it.

At first it was confusing to see you can fetch it as trash and not trash in legacy functions, but eZContentObjectTrashNode extends eZContentObjectTreeNode, and has no fetch function on its own, so the fetch functions on those are doing exactly the same against the ezcontentobject_tree table.

Modified on Thursday 06 February 2014 9:37:18 am by André R

Thursday 06 February 2014 5:28:27 pm

Okay, what I am trying to is basically to update a second database, which is a MongoDB, every time an object is updated/published/removed or restored like in this case. I've written a driver for my database stuff using symfony.

But I think my custom symfony service is not the problem, because even if I delete everything else I've done in the workflow and just try to dump the location object using the symfony service container and the ezpublish repository, it still fails with the exception Could not find Location with identifier..

I do not use any transactions ore modify the ez database in other ways.

It is just confusing, that the legacy node is found and declared as "published", whereas I always get the not found exception, when using symfony. I also tried to load the content object using the ContentService. The content exists, but is not published.

And this only happens, when recovering an item from trash. Updating and creating works fine.

Friday 07 February 2014 9:46:56 am

What do you mean by driver? eZ Publish SPI Persistence implementation?

Are you able to reproduce this outside of workflows?

Monday 10 February 2014 8:46:34 am

No, a custom implementation, without ez publish, just symfony. As I said, I am not trying to hack anything into the ez publish database or the services.  I tried to reproduce it the last days, and it realy happens only when trying to load a restored location with the ez publish repository inside a "publish after" workflow. ("publish before", too, but this is reasonable) This is really frustrating me a bit.

Have you tried to reproduce this situation? I mean, I do not want to to charge you, I am very thankful for your support, but I really wonder whether this is a ez publish bug or somehow my fault. 

Monday 10 February 2014 12:29:56 pm

I have not tried to reproduce as this is quite tricky to reproduce and we can't setup tests for this.
Is the issue still there after the workflow has finished? If so, then I can get someone to reproduce that. 

Monday 10 February 2014 3:52:47 pm

It is there until the restored content gets updated a second time. Then the services work normally. Alright, I can understand that.

Could you tell me whether there is a "publish after" workflow equivalent in symfony?

Maybe I should try my luck outside the legacy kernel.

Monday 10 February 2014 5:58:19 pm

Yes, there are signals fired when something is changed (like published) using API, you can use a slot to listen to them: https://confluence.ez.no/display/EZP/How+to+listen+to+Core+events

Modified on Monday 10 February 2014 6:13:58 pm by André R

Wednesday 12 February 2014 9:24:21 am

Thank you very much!

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from