Author Topic

Nathan Kelly

Friday 23 February 2007 12:23:32 am

Comment47819

Ouch, now my head really hurts...

Bruce, you said that my second example would work if it had a different name, can I assume you mean if I call it &getMyObject() I could then call on this function with something like:

$myclass =& myclass::fetchObject(myclass::getMyObject(), <conditions> );

or

$myclass =& myclass::fetchObjectList(myclass::getMyObject(), <conditions> );

If thats the case I think it might be the easier option, but I'm not sure what <conditions> I need to specify. My new function looks like this:

  function &getMyObject()
  {
    $return = array();
    $query = "SELECT DISTINCT tableOne.* 
    	      FROM tableOne, tableTwo 
	      WHERE tableOne.myObjectID 
	      IN (tableTwo.myObjectID) 
	      ORDER BY myObjectName ASC ";
    $db =& eZDB::instance();
    $result =& $db->arrayQuery($query);
    $return =& myclass::handleRows( $result,'myclass',true );
    return $return;
  }

So if I want to call this from a module what do I put in the <conditions>? I currently have:

$myclass =& myclass::fetchObjectList(myclass::getMyObject(), null, array(), null, array(), true, false, null );

but this returns the same warnings (array_keys and invalid arg foreach) as above. I have tried different arguments but I still don't get the result I want...

Any ideas welcome.

Cheers.

Pardon me while I burst into flames...