Created
January 5, 2014 23:55
-
-
Save amacgregor/8275875 to your computer and use it in GitHub Desktop.
Example Product class for using setter injection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Product { | |
private $stockItem; | |
private $sku; | |
public function __construct($sku){ | |
$this->sku = $sku; | |
} | |
public function getStockItem(){ | |
return $this->stockItem; | |
} | |
public function getSku(){ | |
return $this->sku; | |
} | |
public function setStockItem(StockItem $stockItem){ | |
$this->stockItem = $stockItem; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment