src/Repositories/ProductRepository.php
public function findOneBySku($sku)
    {

        // return the cached result if available
        if ($this->isCached($sku)) {
            return $this->fromCache($sku);
        }

        // if not, try to load the product with the passed SKU
        $this->productStmt->execute(array(MemberNames::SKU => $sku));

        // query whether or not the product is available in the database
        if ($product = $this->productStmt->fetch(\PDO::FETCH_ASSOC)) {
            // add the product to the cache, register the SKU reference as well
            $this->toCache(
                $product[$this->getPrimaryKeyName()],
                $product,
                array($sku => $product[$this->getPrimaryKeyName()])
            );
            // finally, return it
            return $product;
        }
    }
public function findOneBySku($sku)
    {

        // return the cached result if available
        if ($this->isCached($sku)) {
            return $this->fromCache($sku);
        }

        // if not, try to load the product with the passed SKU
        $this->productStmt->execute(array(MemberNames::SKU => $sku));

        // query whether or not the product is available in the database
        if ($product = $this->productStmt->fetch(\PDO::FETCH_ASSOC)) {
            // add the product to the cache, register the SKU reference as well
            $this->toCache(
                $product[$this->getPrimaryKeyName()],
                $product,
                array($sku => $product[$this->getPrimaryKeyName()])
            );
            // finally, return it
            return $product;
        }
    }
public function findOneBySku ( $ sku ) { // return the cached result if available if ( $ this -> isCached ( $ sku ) ) { return $ this -> fromCache ( $ sku ) ; } // if not, try to load the product with the passed SKU $ this -> productStmt -> execute ( array ( MemberNames :: SKU => $ sku ) ) ; // query whether or not the product is available in the database if ( $ product = $ this -> productStmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { // add the product to the cache, register the SKU reference as well $ this -> toCache ( $ product [ $ this -> getPrimaryKeyName ( ) ] , $ product , array ( $ sku => $ product [ $ this -> getPrimaryKeyName ( ) ] ) ) ; // finally, return it return $ product ; } }
Return's the product with the passed SKU.

@param string $sku The SKU of the product to return

@return array|null The product
Return s the product with the passed SKU .