Ver Mensaje Individual
  #15 (permalink)  
Antiguo 06/08/2008, 09:10
Avatar de moron
moron
 
Fecha de Ingreso: mayo-2004
Mensajes: 972
Antigüedad: 20 años
Puntos: 2
Respuesta: splObjectStorage detach

perdon por mi dureza cerebral ..

si no es asi mandame a leer de nuevo, pero creo que ahora lo entiendo.


Código PHP:
class clase
{
    
}

class 
myCustomStorage extends SplObjectStorage {
         public function 
clear() {
                 while( 
$item $this->current() ) {
                        
$this->detach$item );
                        
$item $this->next();
                 }
                 
                 if( 
count$this ) > ) {
                      
$this->detach$this->current() );
                 }         }
}  

class 
lista
{
    private 
$l;
    
    public function 
__construct()
    {
        
$this->l= new myCustomStorage();
        
$this->l->attach(New clase);        
        
$this->l->attach(New clase);    
        
$this->l->clear();
        
    }
    
}

new 
lista 

esto me tira el mismo error que al principio del post:

<b>Warning</b>: SplObjectStorage::detach() expects parameter 1 to be object, null given in <b>PHPDocument2</b> on line <b>16</b><br />