src/Repositories/CategoryProductRepository.php
public function findAllBySku($sku)
    {

        // prepare the params
        $params = array(MemberNames::SKU => $sku);

        // initialize the array for the category product relations
        $categoryProducts = array();

        // load and return the product category relation for the passed product SKU
        $this->categoryProductsBySkuStmt->execute($params);

        // prepare the result by using the category ID as key
        foreach ($this->categoryProductsBySkuStmt->fetchAll(\PDO::FETCH_ASSOC) as $categoryProduct) {
            $categoryProducts[$categoryProduct[MemberNames::CATEGORY_ID]] = $categoryProduct;
        }

        // return the category product relations
        return $categoryProducts;
    }
public function findAllBySku($sku)
    {

        // prepare the params
        $params = array(MemberNames::SKU => $sku);

        // initialize the array for the category product relations
        $categoryProducts = array();

        // load and return the product category relation for the passed product SKU
        $this->categoryProductsBySkuStmt->execute($params);

        // prepare the result by using the category ID as key
        foreach ($this->categoryProductsBySkuStmt->fetchAll(\PDO::FETCH_ASSOC) as $categoryProduct) {
            $categoryProducts[$categoryProduct[MemberNames::CATEGORY_ID]] = $categoryProduct;
        }

        // return the category product relations
        return $categoryProducts;
    }
public function findAllBySku ( $ sku ) { // prepare the params $ params = array ( MemberNames :: SKU => $ sku ) ; // initialize the array for the category product relations $ categoryProducts = array ( ) ; // load and return the product category relation for the passed product SKU $ this -> categoryProductsBySkuStmt -> execute ( $ params ) ; // prepare the result by using the category ID as key foreach ( $ this -> categoryProductsBySkuStmt -> fetchAll ( \ PDO :: FETCH_ASSOC ) as $ categoryProduct ) { $ categoryProducts [ $ categoryProduct [ MemberNames :: CATEGORY_ID ] ] = $ categoryProduct ; } // return the category product relations return $ categoryProducts ; }
Return's the category product relations for the product with the passed SKU.

@param string $sku The product SKU to load the category relations for

@return array The category product relations for the product with the passed SKU
Return s the category product relations for the product with the passed SKU .