Last active
August 29, 2015 14:05
-
-
Save revsbech/77331f59be2ec56d4dae to your computer and use it in GitHub Desktop.
This file contains 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 Tx_MocBeer_Domain_Model_Consumer { | |
/** | |
* @var Tx_MocBeer_Domain_Service_InventoryService | |
* @inject | |
*/ | |
protected $inventoryService; | |
/** | |
* @param Tx_MocBeer_Domain_Service_InventoryService $service | |
*/ | |
public function injectInventoryService(Tx_MocBeer_Domain_Service_InventoryService $service) { | |
$this->inventoryService = $service; | |
} | |
/** | |
* @param Tx_MocBeer_Domain_Model_Beer $beer | |
* @return void | |
*/ | |
public function drinkBeer(Tx_MocBeer_Domain_Model_Beer $beer) { | |
$beer->open(); | |
//@todo: Do actual drinking... | |
$this->inventoryService->removeBeerFromInventory($beer); | |
} | |
} |
This file contains 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 Tx_MocBeer_Domain_Service_InventoryService implements t3lib_Singleton { | |
/** | |
* @param Tx_MocBeer_Domain_Model_Beer $beer | |
*/ | |
public function removeBeerFromInventory(Tx_MocBeer_Domain_Model_Beer $beer) { | |
$message = date("d/m-Y H:i") . "\t" . $beer->getName() . ' removed from inventory'; | |
file_put_contents(PATH_site . 'typo3temp/moc_beer.log', $message . PHP_EOL, FILE_APPEND); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment