0

i'm create a dating website using symfony 1.4 (it's my first project using symfony). the problem is there server freezes if there is only 10 or less users online. i tryied optimizing my js, css, sprites using yslow i got grade A but still the problem is always there. that's why i think the way i build the application might be wrong so here is the website naijaconnexion.com i'm asking u for advices and things to do so i overcome this problem

If i wasn't clear enough just ask, if you want cpanel admin access i'll post it

i realy realy needs your help

for instance i have this code on my home page action does it seems ok or it needs to be optimized and how

    $this->me = $this->getUser()->getGuardUser()->getPerson();
    $this->cities = Doctrine_Core::getTable('City')->findByDql("zipcode=''");
    $this->countries = Doctrine_Core::getTable('City')->findByDql("zipcode='10'");
    $this->contacts = $this->me->getContacts();
    $this->favorites = $this->me->getFavorites();
    $this->matches = $this->me->getMatches();
    $this->pager = new sfDoctrinePager('Conversation', sfConfig::get('app_home_conversations_per_page'));
    $this->pager->setQuery($this->me->getConversationsQuery());
    $this->pager->setPage($request->getParameter('page', 1));
    $this->pager->init();

without HYDRATE_ARRAY i can do this

if i use HYDRATE_ARRAY will i be able to do stuff like $this->contacts[0]['username'];

help please

erratbi
  • 87
  • 12
  • 2
    Still the same [problem](http://stackoverflow.com/questions/11144597/symfony-memory-issues)? Why not reply to the other answer and provide more information too ? – j0k Jun 27 '12 at 18:28
  • just ask anything you want me to clarify ;) – erratbi Jun 27 '12 at 18:38

1 Answers1

0

The problem is doctrine...

Try to fetch the needed values as array and set a limit!

How many objects are returned by the following queries:

$this->cities = Doctrine_Core::getTable('City')->findByDql("zipcode=''");
$this->countries = Doctrine_Core::getTable('City')->findByDql("zipcode='10'");
$this->contacts = $this->me->getContacts();
$this->favorites = $this->me->getFavorites();
$this->matches = $this->me->getMatches();

? Do not forget that they are object with references to other objects!

And yes, this will work $this->contacts[0]['username'];.

if you join the tables with the doctrine query, you can access related entities too - without executing additional queries.

$this->contacts = Doctrine_Core::getTable('Contact')
        ->createQuery('c')
        ->leftJoin('c.Users u')
        ->addWhere('...')
        ->execute(array(), Doctrine_Core::HYDRATE_ARRAY);


$this->contacts[0]['Users'][0]['username']
Besnik
  • 6,469
  • 1
  • 31
  • 33
  • Hello after some testing i've noteced a huge memory leak again i'm using Hydration Array mode but still the server blacks out after a while here is the url : http://www.chat.1000mabrouk.ma login : jasiri pass : 123456 would you test it urself and tell me what is the problem plz – erratbi Jul 07 '12 at 09:38