Created
December 31, 2010 07:37
-
-
Save seanhess/760829 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
R::gen("BlogPost"); | |
$post = new BlogPost(); | |
$post->title = "Title"; | |
$post->description = "description"; | |
$post->save(); |
This file contains hidden or 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
<?php | |
require_once('libs/redbean/oodb.php'); | |
R::gen("BlogPost","Comment"); | |
$post = new BlogPost(); | |
$post->title = "New Blog Title"; | |
$post->description = "This is a sweet message and stuff"; | |
$comment = new Comment(); | |
$comment->user = "sean"; | |
$comment->message = "I think this post is great"; | |
$post->add($comment); | |
// we're just loading the 1st on the db, but you could | |
// find a particular one if you wanted. | |
$currentPost = new BlogPost(1); | |
$comments = $currentPost->getRelatedComment(); | |
// Print them out in a view |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment