Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Last active December 12, 2015 06:38
Show Gist options
  • Save coreymcmahon/4730337 to your computer and use it in GitHub Desktop.
Save coreymcmahon/4730337 to your computer and use it in GitHub Desktop.
A model implementation using the repository pattern. From the article: PDO for Elegant PHP Database Access, http://www.modernphpbook.com/articles/pdo-for-elegant-php-database-access - Fig 3
<?php
class UserModel
{
public static function getUser($id)
{
$repository = new UserRepository();
return $repository->find($id);
}
// etc...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment