public function findByProduct($product, array $options = array())
    {
        if (!$product instanceof Product) {
            $product = $this->api('subbly.product')->find($product);
        }

        $query = $this->newCollectionQuery($options);
        $query->with(array('product' => function ($query) use ($product) {
            $query->where('uid', '=', $product->uid);
        }));

        return new Collection($query);
    }
public function findByProduct($product, array $options = array())
    {
        if (!$product instanceof Product) {
            $product = $this->api('subbly.product')->find($product);
        }

        $query = $this->newCollectionQuery($options);
        $query->with(array('product' => function ($query) use ($product) {
            $query->where('uid', '=', $product->uid);
        }));

        return new Collection($query);
    }
public function findByProduct ( $ product , array $ options = array ( ) ) { if ( ! $ product instanceof Product ) { $ product = $ this -> api ( 'subbly.product' ) -> find ( $ product ) ; } $ query = $ this -> newCollectionQuery ( $ options ) ; $ query -> with ( array ( 'product' => function ( $ query ) use ( $ product ) { $ query -> where ( 'uid' , '=' , $ product -> uid ) ; } ) ) ; return new Collection ( $ query ) ; }
Find a ProductCategory by Product.

@example
$productCategory = Subbly::api('subbly.product_category')->findByProduct($product);

@param string|\Subbly\Model\Product $product The Product model or the Product uid
@param array                        $options Some options

@return \Subbly\Model\Collection

@api
Find a ProductCategory by Product .