Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony] Symfony2 - The EntityManager is closed, Na lokalu działa na serwerze nie :/
Ghost_78
post
Post #1





Grupa: Zarejestrowani
Postów: 222
Pomógł: 34
Dołączył: 3.11.2010

Ostrzeżenie: (0%)
-----


Witam serdecznie.
Mam dzisiaj następujący problem. Od jakiegoś czasu bawię się z Symfony 2.
Mój problem jest następujący. Napisałem sobie komendę do crona. W skrócie wygląda to tak.

  1. class CronCommand extends ContainerAwareCommand
  2. {
  3. protected $em;
  4. protected $log;
  5.  
  6. protected function configure()
  7. {
  8. $this->setName('cron:go')
  9. ->setDescription('update collection ranking');
  10. }
  11.  
  12. protected function execute(InputInterface $input, OutputInterface $output)
  13. {
  14. $this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
  15. $this->log = $this->em->getRepository('AppsBaseBundle:Log');
  16. $minutes = date('i');
  17. $hours = date('H');
  18.  
  19. //$this->all();
  20. //if($minutes == '00'){
  21. $this->fullHour();
  22. //}
  23. if($hours == '00' && $minutes == '00'){
  24. $this->endOfTheDay();
  25. }
  26.  
  27. }
  28.  
  29. protected function fullHour(){
  30. try{
  31. $Ranking = new \Apps\BaseBundle\Util\Event\Ranking();
  32. $Ranking->actualizeAll($this->em,\Apps\BaseBundle\Util\Event\Ranking::DAILY);
  33. $comm = 'Zaktualizowany ranking godzinowy';
  34. echo $comm."\n";
  35. $this->log->addLog(__CLASS__.':'.__FUNCTION__,
  36. $comm,
  37. Log::NOTIFY);
  38. } catch (\Exception $e){
  39. echo $e->getMessage()."\n";
  40. $this->log->addLog(__CLASS__.':'.__FUNCTION__,
  41. 'Wyjątek: '.$e->getMessage(),
  42. Log::EXCEPTION);
  43. }
  44. }


Problem jest następujący. Po odpaleniu tego z konsoli na jednym komputerze wszystko działa a na drugim (te same wszystkie pliki) dostaję komunikat:
The EntityManager is closed.

Bladego pojęcia nie wiem w czym może być problem.
Będę bardzo wdzięczny za wszelkie wskazówki.

Pozdrawiam.

[EDIT]
Dodam tylko, że nigdzie nie zamykam EM.

Ten post edytował Ghost_78 21.05.2012, 15:16:34


--------------------
Always look on the bright side of life ;-)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 16:27