private function getProductUnits($locale)
    {
        /** @var Unit[] $productUnits */
        $productUnits = $this->get('sulu_product.unit_repository')->findAllByLocale($locale);

        $result = [];

        foreach ($productUnits as $productUnit) {
            $result[] = [
                'id' => $productUnit->getId(),
                'name' => $productUnit->getTranslation($locale)->getName(),
            ];
        }

        return $result;
    }
private function getProductUnits($locale)
    {
        /** @var Unit[] $productUnits */
        $productUnits = $this->get('sulu_product.unit_repository')->findAllByLocale($locale);

        $result = [];

        foreach ($productUnits as $productUnit) {
            $result[] = [
                'id' => $productUnit->getId(),
                'name' => $productUnit->getTranslation($locale)->getName(),
            ];
        }

        return $result;
    }
private function getProductUnits ( $ locale ) { /** @var Unit[] $productUnits */ $ productUnits = $ this -> get ( 'sulu_product.unit_repository' ) -> findAllByLocale ( $ locale ) ; $ result = [ ] ; foreach ( $ productUnits as $ productUnit ) { $ result [ ] = [ 'id' => $ productUnit -> getId ( ) , 'name' => $ productUnit -> getTranslation ( $ locale ) -> getName ( ) , ] ; } return $ result ; }
Returns all product units.

@param string $locale

@return array
Returns all product units .