Witam,
Mam trochę dziwny problem, a mianowicie podczas pobieranie danych z bazy do do P.A. przy pomocy Doctrine otrzymuje błąd (błąd wrzuciłem na końcu postu), jednak pokazany błąd wyskakuje jedynie, gdy kod Doctriny umieszczę w pliku MODELU w tym przepadku Site.php, a gdy ten sam kod pobierania danych umieszczę w jakiś KONTROLERZE to dane są pobierane bez problemu w czym tkwi problem?

KOD UMIESZCZONY W MODELU Site.php (WYRZUCA BŁEDY):
  1. $currentPage = 1;
  2. $resultsPerPage = 10;
  3.  
  4. $pager = new Doctrine_Pager(
  5. $q = Doctrine_Query::create()
  6. ->select('u.id_sites, u.url, u.title, u.body, u.meta_keywords, u.meta_description, u.del')
  7. ->from('Site u'),
  8. //->orderBy(sprintf('u.%s %s', $sidx, $sord)),
  9. $currentPage, // Current page of request
  10. $resultsPerPage // (Optional) Number of results per page. Default is 25
  11. );
  12. $sites = $pager->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
  13.  
  14. print_r($sites);


KOD UMIESZCZONY W KONTROLERZE (POPRAWNIE POBIERA DANE):
  1. $currentPage = 1;
  2. $resultsPerPage = 10;
  3.  
  4. $q = new Site();
  5. $pager = new Doctrine_Pager(
  6. $q = Doctrine_Query::create()
  7. ->select('u.id_sites, u.url, u.title, u.body, u.meta_keywords, u.meta_description, u.del')
  8. ->from('Site u'),
  9. //->orderBy(sprintf('u.%s %s', $sidx, $sord)),
  10. $currentPage, // Current page of request
  11. $resultsPerPage // (Optional) Number of results per page. Default is 25
  12. );
  13. //$pager = getExecuted();
  14. //var_dump($pager);
  15. $sites = $pager->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
  16.  
  17. print_r($sites);


Błąd jaki otrzymuje po uruchomieniu kodu w Modelu Site.php:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error</H1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<P>
Please contact the server administrator,
admin@vel.pl and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<P>
More information about this error may be available
in the server error log.<P>
</BODY></HTML>

Dane pobieram w do tabeli jqGrid i dlatego wykorzystuje Doctrine ponieważ w bardzo przyjemny sposób dzieli dane na strony.

Proszę o pomoc bo nie mam pojęcia co może powodować jakie dziwne zachowanie ;/

Pozdrawiam
Tejek

Problem rozwiązany wystarczy wprowadzić drobną zaminę:

Ten kawałek kodu zamienić:
  1. $sites = $pager->execute(array(), Doctrine_Core::HYDRATE_ARRAY);


na taki:
  1. $pager->execute();
  2. $sites = $pager->toArray();