back again - I'm scratching my head again here ..
I am using a design pattern known as intercepting filter which is based on a simple linked list .
when I instantiate my filterroot I send an array of other concrete filters and the constructor iterates through them and sets the _childFilter and _hasChild attributes acordingly in a simple while loop
Code: Select all
class FilterChainRoot
{
var $_filters;
function FilterChainRoot($filters)
{
//iterate through the InterceptingFilter array and
//add them to the chain of filters to execute
$this->_filters =& $filters;
$count = count($this->_filters);
$index = 0;
while ($index <= ($count - 1)):
if ($index > 0)
{
$tmp =& $this->_filtersї$index - 1];
$tmp->setChild($filtersї$index]);
//debug <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>
//echo get_class($tmp)." child is set as - ".get_class($tmp->getChild())."<br>";
}
$index++;
endwhile;
}
function execute($args)
{
//perform first execute in our chain
//each filter in the chain will check whether
//it has a child .. if so it will apss on its
//execute down the chain
$tmp = $this->_filtersї0];
return $tmp->execute($args);
}
}this is done by each execute method inside a concrete InterceptingFilter class first checks whether it has a child filter then calls its execute method
eg
Code: Select all
...
if ($this->_hasChild)
{
$tmp =& $this->_childFilter;
return $tmp->execute($arg);
}
...the offending snippet is below
Code: Select all
...
$obj =& $this->_childFilter;
$response = $obj->execute($args);Fatal error: Call to a member function on a non-object in C:\Documents and Settings\ant\My Documents\objectmonkey_source\ViewFilter.php on line 13
if any of you have any ideas where I am going wrong it would be very greatly appreciated .. thanks