Mam taką klasę:

 
	class testContr {
		/* @var $pdo PDO */
		private $pdo;
		private $Usr;
		private $array_ctg=null;
		private $array_tpc=null;
		private $array_rpl=null;

		public function __construct($pdo, $UserId) {
			$this->pdo=$pdo;
			$this->Usr=$UserId;
		}
		public function getCtg() {
			if(is_null($this->array_ctg)) {
				$dane=$this->pdo->query("SELECT * FROM katg ORDER BY kolejnosc DESC");
				$this->array_ctg=$dane->fetchAll();
				$dane->closeCursor();
			}
			return $this->array_ctg;
		}
		public function getTpc() {
			if(is_null($this->array_ctg)) {
				$this->getCtg();
			}
			if(is_null($this->array_tpc)) {
				$dane=$this->pdo->prepare("SELECT * FROM tab1_pst ORDER BY poziom DESC, ostatnia DESC");
				foreach($this->array_ctg as $value) {
					$dane->bindValue(":cat",$value['id'],PDO::PARAM_INT);
					$dane->execute();
					$this->array_tpc[$value['id']]=$dane->fetchAll();
					$dane->closeCursor();
				}
			}
			return $this->array_tpc;
		}
		public function getRpl($tId) {
			if(is_numeric($tId)) {
				if(is_null($this->array_rpl)) {
					$dane=$this->pdo->prepare("SELECT * ORDER BY dodany");
					$dane->bindValue(":tid", $tId, PDO::PARAM_INT);
					$dane->execute();
					$this->array_rpl[$Id]=$dane->fetchAll();
					$dane->closeCursor();
				}
				return $this->array_rpl[$Id];
			} else {
				return false;
			}
		}
		public function test() {
		             return $this->array_ctg;
		}
	}

i taki kod:

$obc = new testContr($pdo, $session->UserId());

$bla=$obc->getCtg();
$blu=$obc->getTpc();

$abc=$obc->test();
 

Obiekt jest tworzony, pierwsze dwie metody dziłają prawidłowo ($bla i $blu zawierają dane z bazy) natomiast $abc jest puste (null). Jak dodałem w test() print_r:

 
public function test() {
//return $this->array_ctg;
print_r($this->array_ctg);
}

To wyświetlana jest pusta tablica.

Nawet jak zrobie w kodzie

print_r($obc); 

To pokazuje ze wszystkie pola obiektu są puste, za wyjątkiem $Usr. Co robie zle?
Funkcje getCtg() lub getTpc() mogę wywoływać wielokrotnie i działają prawidłowo, pobierają dane z bazy i zwracają je.

 print_r($this->array_ctg); 

zawarte w jednej z tych funkcji (niezaleznie od miejsca) pokazuje tablice wypelniona danymi. Co jest nie tak?