Slide 14
Slide 14 text
use Cocoders\MedicalClinic\ClinicRegistry as ClinicRegistryInterface;
final class SqlClinicRegistry implements ClinicRegistryInterface
{
//..
public function find(TaxIdNumber $taxIdNumber)
{
$clinicArray = $this->connection->fetchColumn("SELECT * FROM clinics
WHERE taxIdNumber = :taxIdNumber", ['taxIdNumber' => (string)
$taxIdNumber]);
if ($clinicData) {
return new Clinic(new TaxIdNumber($clinicArray['taxIdNumber']),
$clinicArray['name']);
}
}
}
@cocoders
Abstrakcja - przykłady