Author Topic

Bruce Morrison

Thursday 22 February 2007 10:49:01 pm

Comment47817

Hiya Nathan

According to the &definition(), 'myObjectID' should be dictinct/unique as it is defined as the key. If it's not you may run into issues with using the eZPersistantObject class with this data.

I suspect you can do something like this (untested) to get the query you want

$custom = array( array( 'operation' => 'DISTINCT myObjectID',
                             'name' => 'myObjectID' ) );

$rows =& myclass::fetchObjectList( myclass::definition(), array(), null, null, null, false, false, $custom);

See http://pubsvn.ez.no/doxygen/classeZPersistentObject.html#3c3bffe097597c30da48c2f10039f470
for more info on this. The above is based on the "Counting number of elements." example

As for the 2nd method the &definition() has to return array as in the first example.

The code you have in the function will work is called something else.

HTH

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish