zend framework - Create a statitics table for calls made with Doctrine -


i trying set eoctrine table, this:

provider caller callsrequested callsfailed x                20              1 y          b       15              0 x          b       5               0 

and on. doing this:

$repository = $this->entitymanager->getrepository(stats::class);         $stats = $repository->findby(       array('provider' => $provider, 'callcenter'=> $callcentercontact));   //returns null           if (!$stats) {             $stats = new stats;             $stats->setprovider($provider);             $stats->setcallcenter($callcentercontact);             $stats->setcalls_requested(1);              $this->entitymanager->persist($stats);             $this->entitymanager->flush();            }           else{             $count=$stats->getcalls_requested();             $stats->setcalls_requested($count+1);             $id =  $stats->getid();                   $stats->setid($id);             $this->entitymanager->persist($stats);               $this->entitymanager->flush();           } 

but getting 2 problems:

  • it creates me row each call request, new id,
  • it not increment number of calls.

how can want?

in else try this

        else{             $count=$stats->getcalls_requested();             $stats->setcalls_requested($count+1);             $this->entitymanager->merge($stats);               $this->entitymanager->flush();           } 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -