Add saving for aggregated rider rating. #764
This commit is contained in:
parent
cf34519385
commit
25d7c30f73
1 changed files with 15 additions and 4 deletions
|
|
@ -9,7 +9,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\RiderRating;
|
||||
use App\Entity\AggregatedRiderRating;
|
||||
|
||||
use PDO;
|
||||
|
|
@ -87,9 +86,21 @@ class LoadAggregateRiderRatingsComand extends Command
|
|||
{
|
||||
error_log(print_r($agg_rider_ratings, true));
|
||||
|
||||
// TODO: create new AggregatedRiderRating object
|
||||
foreach ($agg_rider_ratings as $key => $data)
|
||||
{
|
||||
// create new AggregatedRiderRating object
|
||||
$obj = new AggregatedRiderRating();
|
||||
|
||||
// set fields
|
||||
$obj->setRiderId($key)
|
||||
->setAggregateRating($data['agg_rating'])
|
||||
->setAggregateCount($data['agg_count']);
|
||||
|
||||
// save to database
|
||||
$this->em->persist($obj);
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
protected function getRiderIds()
|
||||
|
|
|
|||
Loading…
Reference in a new issue