VoteAverage example

use DateTime;
use Shopware\Bundle\StoreFrontBundle\Struct\Product\Vote;
use Shopware\Bundle\StoreFrontBundle\Struct\Product\VoteAverage;

class VoteHydrator extends Hydrator
{
    /** * @return VoteAverage */
    public function hydrateAverage(array $data)
    {
        $struct = new VoteAverage();

        $points = 0;
        $total = 0;

        foreach ($data as $row) {
            $points += $row['points'] * $row['total'];
            $total += $row['total'];
        }

        $this->sortByPointsDescending($data);

        
Home | Imprint | This part of the site doesn't use cookies.