Created
August 13, 2015 13:29
-
-
Save phpdave/e6d5b18f6ed01dfe6970 to your computer and use it in GitHub Desktop.
Pattern Examples
This file contains 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
<? | |
$post = new Post(); | |
$post->title = 'My first blog post!!'; | |
$post->author_id = 5; | |
$post->save(); | |
# save runs SQL to insert the row into the db |
This file contains 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
<? | |
$post = new Post(); | |
$post->title = 'My first blog post!!'; | |
$post->author_id = 5; | |
$mapper = new PostMapper($pdo); | |
$mapper->save($post); |
This file contains 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
<? | |
$post = new Post(); | |
$post->title = 'My first blog post!!'; | |
$post->author_id = 5; | |
$mapper = new PostMapper(); | |
$postTableGateway = new PostTableGateway(); | |
$postRepository = new PostRepository($mapper,$postTableGateway); | |
$postService = new PostService($postRepository); | |
$postService->publish($post); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment