mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-25 22:09:23 +02:00
added DataMapper Example
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns;
|
||||
|
||||
/**
|
||||
* DataMapper pattern
|
||||
*
|
||||
* Testing the DataMapper Pattern
|
||||
*/
|
||||
|
||||
$userMapper = new UserMapper();
|
||||
|
||||
$user = $userMapper->find(1);
|
||||
|
||||
if ($user !== null) {
|
||||
echo "Hello " . $user->getUsername() . ". Your email is " . $user->getEmail();
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user