This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Developer » fetch object ids only for use in...

fetch object ids only for use in custom fetch function

fetch object ids only for use in custom fetch function

Friday 28 September 2012 12:36:06 pm - 2 replies

I am creating a new custom fetch function. It is currently working fine however at one point I require an array of object ids from a particular node subtree. I am currently fetching a list of all the objects in my php script. Is there a way of fetching the ids only without retrieving a list of the objects themselves as this is a bigger performance hit that I do not need. 

Friday 28 September 2012 3:06:21 pm

Hi Jon,

Please checkout

Sunday 30 September 2012 10:12:26 pm


Best doc is in the actual class sourrce itself:


Keep in mind: this is NOT just for contentobjects.  most things of interest in eZ Publish inherit ezersistentObject and also implement ::definition (about itself - the fields, etc)

So, you can actually use ezPersistentObject-->fetchObjectList(eZContentObjectTreeNode::definition, other parameters.... (see link above)

So, to get what you want:

  • return array (not object)
  • group by contentobject_id (a field for a node using the definition above)
  • limit fields to contentobject_id
  • create your parameters to isolate your results (parent_node or subtree_path, perhaps)

The end result will just be something like:

array(array(contentobject_id=>###), array(contentobject_id=>###), array(contentobject_id=>###), array(contentobject_id=>###), )

I ususally loop through this once, throw the results as keys of a new array and the use array_keys() on the new array where I want to use it as a clean list of ids in some other function or return value.




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

36 542 Users on board!

Forums menu

Proudly Developed with from