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

eZ Community » Forums » eZ Publish 5 Platform » How to check if a location is main...

How to check if a location is main location in ez5?

How to check if a location is main location in ez5?

Monday 04 February 2013 10:24:38 pm - 2 replies

Hello. For my project i need to add some locations to several objetcs, and set main location for these new locations in some cases. I have some questions:

  1. Is this implemented in ez5 already?
  2. If so, could you please explain wich class/classes are taking care of this?

Thank you!. 

Modified on Monday 04 February 2013 10:25:13 pm by Carlos Revillo

Tuesday 05 February 2013 7:48:25 am

To see which is the main location, use $location->getContentInfo()->mainLocationId also available on $content->getVersionInfo()->getContentInfo()

To set the main location use $repository->getContentService()->updateContentMetaData( $contentMetaupdateStruct );

This property is indeed on a bit un logical location, you would probably have expected it in the Location domain.

Modified on Tuesday 05 February 2013 7:49:12 am by André R

Tuesday 05 February 2013 9:03:42 am

Thanks André. Yes, I was looking exactly there. But well, maybe is not unlogical to have it where it is. thinking in "ezlegacy" way, object has locations and a main location, so this also makes sense to me. 

Btw, these locations i'm trying to add is just a workaround for what i really need. I need to move locations from a folder to other folders, but, as said in this jira issue, moving location is possible but there is no redirection from old location to new location as "ezlegacy" does. 

so i thought in this workaround and i plan to extend viewcontroller to make a redirect from non main location to main location... 


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

36 542 Users on board!

Forums menu

Proudly Developed with from