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 » Public API - copy content
expandshrink

Public API - copy content

Public API - copy content

Friday 14 November 2014 4:04:21 pm - 3 replies

Hello,

I'm having some problems with copyContent method from ContentService.. After I copy the content, I try to use it's main location id, however, it comes up as a null. I have tried reloading it, but that also didn't work.

From what I have figured out, copyContent first creates the content (and that clears the content cache), and then creates the location (which cleares location cache). However, the content cache isn't cleared after creating the location, so the content doesn't know about it's location.

I have worked around this by manually clearing the content cache after copying it:

 
 
$cacheDecorator =$this->container->get( 'ezpublish.cache_pool.spi.cache.decorator' );
$cacheDecorator->clear( 'content',  $copiedContent->id, $copiedContent->contentInfo->currentVersionNo )
 

 

I'm just wondering is this a bug or am I missing something here? Also, is this the best way to go about it for now?

Thanks!

Modified on Friday 14 November 2014 4:12:31 pm by Ivan Herak

Friday 14 November 2014 4:06:16 pm

Hello Ivan,

Can you edit your embedded code to remove the span tags. Right now it's just unreadable.

Thanks!

Cheers,
Heath 

Friday 14 November 2014 4:13:16 pm

Quote from // Heath :

Hello Ivan,

Can you edit your embedded code to remove the span tags. Right now it's just unreadable.

Thanks!

Cheers,
Heath 

Yeah, sorry about that, first time posting here happy.gif Emoticon I hope it's better now...

Saturday 06 December 2014 1:36:33 pm

This would sound like a bug to me.

Do you think you could provide a simple script (comcand, or just code, that reproduces the issue . You can also report it on http://jira.ez.no.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from