Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/01/2007, 11:12
nanus
 
Fecha de Ingreso: enero-2007
Mensajes: 1
Antigüedad: 17 años, 3 meses
Puntos: 0
Using $this when not in object context

Hola a todos, Soy nuevo en PHP y estoy teniendo problemas al pasar un objeto a otra clase...

$p = new Product(array('product_id'=>$product_id));
$p->parents();

Dentro de la clase Product, tengo entre otras estas funciones...
function parents()
{
return $this->tree()->parents();
}
function tree()
{
if ($this->tree === NULL)
{
$this->tree = new Tree;
$this->tree->node($this);
}
return $this->tree;
}

En la clase Tree...

public function node($o=NULL)
{
if ($o !== NULL)
{
if (is_object($o) && ($o instanceof Base))
{
$class = get_class($o);
if ($this->node !== NULL // AQUI ME DA EL PROBLEMA
...............
..........
}

EL ERROR ES...... Using $this when not in object context in......

Alguien me puede dar una pista? he estado probando diferentes cosas pero no consigo avanzar..

Muchas gracias.