attribute_filter for attribute of Object Relations type

Author Message

Michal Slocinski

Saturday 21 November 2009 10:15:15 am

Hi,

I've problem with searching for objects using attribute_filter attribute in fetch list function.

I have following code in my template:

{def $list=fetch(content,list,hash(
  parent_node_id, 2, 
  depth, 8, 
  class_filter_type, 'include',
  class_filter_array, array('item'),
  attribute_filter, array( array('item/artist', '=', '60') )
  
  ))}
  
  {$list|attribute(show,1)}

where 'artist' is name of attribute of Object Relations type and 60 is ID of related object I'm looking for. The thing it that it doesn't matter what ID I put there, because even if I try '!=' above code doesn't return any results.

If I change my Object Relations attribute to Object Relation - filtering seems to work fine.

Is it limitation of Object Relations attribute?

Is there any way to workaround it or extend Object Relations type?

Any hints are appreciated.

Michal

Nicolas Lescure

Saturday 21 November 2009 11:17:57 am

Hi,

It is normal. Filtering an object relations is not supported : http://ez.no/doc/ez_publish/technical_manual/4_x/reference/modules/content/fetch_functions/list

But, you can use this extension : http://projects.ez.no/objectrelationfilter 

Michal Slocinski

Sunday 22 November 2009 2:14:29 am

Thank you Nicolas, you saved me lot of work.

I wonder why such useful extension has not been yet integrated with product, especially that is really filling a gap in the core of eZ Publish.

Nicolas Lescure

Monday 23 November 2009 4:11:24 am

You're welcome.

Yes, I also think this extension is a "must have". But, I still don't understand why object relation and object relations datatypes don't use the same structure.

For object relation, the relation is stored using the db. So you can find relations with a join. But object relations are stored in a single row, with an xml structure. It should be easy to use the db instead.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.