All pastes #126295 Raw Edit

lugzer

public text v1 · immutable
·published 2006-08-11 09:36 UTC
rendered paste body
// why not like this
// constructor just takes data from product table
$product = new Product(934); 

// now i get category ID
$catId = $product->getCategoryId(); 

// and instantiate a category class to get category name
$category = new ProductCategory($catId);
$catName = $category->getName();

/** ------------- **/
// while some people advise this:
$product = new Product(882); // constructor takes all data from all related tables

// and this method simply gets the category name
$catName = $product->getCategoryName(); 

// why have the ProductCategory class then ??


// .....