public static function getAllEntitiesAsObjects() {
   $sql = "SELECT \"jednostka_id\", \"typ\" from \"jednostka\"";
   $res = pg_query(DataManager::_getConnection(), $sql);

   if(!$res) {
      die("Bd pobierania wszystkich jednostek!");
   }

   if(pg_num_rows($res)) {
      $objs = array();
      while($row = pg_fetch_assoc($res)) {
         if($row['typ'] == 'I') {
            $objs[] = new Individual($row['jednostka_id']);
         } elseif ($row['typ'] == 'O') {
            $objs[] = new Organization($row['jednostka_id']);
         } else {
            die("Nieznany typ jednostki {$row['typ']} !");
         }
      }
      return $objs;
   } else {
      return array();
   }
}