在非对象上调用成员函数getIdAluno()

need help with some code here

I have a collection of the Classe notas, and i'm getting the information from the database useing this code:

$this->notas = new Collection();
    $this->carregaArray();

public function carregaArray(){
$link = mysql_connect('localhost:3307', 'root', 'usbw');
$l = mysql_select_db('estagio', $link);
$sql = "Select * From notas";
$result = mysql_query($sql,$link);
while($row = mysql_fetch_assoc($result)){
    $this->notas->addItem($row);
    }
        }

I'm trying to use the $this->notas on this method:

public function procurarNota($idAluno,$idElemento){
        if(!($this->notas->isEmpty())){
            foreach($this->notas->getAll() as $nota){
            for ($i = 0; $i <= $this->notas->getLength(); $i++){
                if($this->notas->getItem($i)->getIdAluno() && $this->notas->getItem($i)->getIdComp() == $idElemento){
                    return $nota;
                    }
                }
            }
        }
        return 0;
}  

But it's giving me this error:

Call to a member function getIdAluno() on a non-object in D:\8.5oot\classes\UC.php on line 709

What am i doing wrong ?

Cheers