Skip to content

Instantly share code, notes, and snippets.

@voocx
Forked from johannilsson/ddd.php
Created April 18, 2017 15:03
Show Gist options
  • Select an option

  • Save voocx/5d7823850bca275f04beb5ebed027f2b to your computer and use it in GitHub Desktop.

Select an option

Save voocx/5d7823850bca275f04beb5ebed027f2b to your computer and use it in GitHub Desktop.
<?php
class Domain_Model_User {
private $id;
private $name;
}
interface Domain_Model_UserRepository {
public function save(Domain_Model_User $user);
public function find($id); // Returns Domain_Model_User
}
class UserService {
public __construct(Domain_Model_UserRepository $userRepository) { ... }
public function doSomething();
}
// Some implementations...
class Infrastructure_Persistence_UserRepositoryXml implements Domain_Model_UserRepository {
...
}
class Infrastructure_Persistence_UserRepositoryMySql implements Domain_Model_UserRepository {
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment