-
-
Save wkocmann/4f6843e15db5401cdefc to your computer and use it in GitHub Desktop.
multilingual value object and repository
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 Country | |
{ | |
public $ISO; | |
public $Name; | |
public function __construct($ISOCode, $Name) | |
{ | |
$this->ISO = $ISOCode; | |
$this->Name = $Name | |
} | |
} | |
class CountryRepository | |
{ | |
private $countries = array( | |
array('ISO' => 'AT', 'Name' => 'Austria'), | |
array('ISO' => 'DE', 'Name' => 'Germany'), | |
array('ISO' => 'BE', 'Name' => 'Belgium') | |
); | |
public function findAll() | |
{ | |
$ret = array(); | |
for ($i = 0, $lC = count($this->countries); $i < $lC; $i++) { | |
$ret[] = New Country($this->countries['ISO'], $this->countries['Name']); | |
} | |
return $ret; | |
} | |
} | |
class EN_CountryRepository extends CountryRepository {} | |
class DE_CountryRepository extends CountryRepository | |
{ | |
private $countries = array( | |
array('ISO' => 'AT', 'Name' => 'Österreich'), | |
array('ISO' => 'DE', 'Name' => 'Deutschland'), | |
array('ISO' => 'BE', 'Name' => 'Belgien') | |
); | |
} | |
class NL_CountryRepository extends CountryRepository | |
{ | |
private $countries = array( | |
array('ISO' => 'AT', 'Name' => 'Oostenrijk'), | |
array('ISO' => 'DE', 'Name' => 'Duitsland'), | |
array('ISO' => 'BE', 'Name' => 'België') | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment