public function category($name)
{
// Check if the category is lazy loaded
if ($this->isLazyLoaded($name)) {
// Yes it is, split out the value from the array
$this->defaultCategory = $this->getCategoriesContainer($name);
// set category on the builder
parent::category($this->defaultCategory->id);
return $this;
}
// Otherwise ask to the db and give me the right category
// associated with this name. If the category is not found
// it throw CategoryNotFoundException
$category = $this->notifynderCategory->findByName($name);
$this->defaultCategory = $category;
// Set the category on the array
$this->setCategoriesContainer($name, $category);
// set category on the builder
parent::category($category->id);
return $this;
}