Skip to content

Instantly share code, notes, and snippets.

@seanhess
Created December 31, 2010 07:37
Show Gist options
  • Save seanhess/760829 to your computer and use it in GitHub Desktop.
Save seanhess/760829 to your computer and use it in GitHub Desktop.
R::gen("BlogPost");
$post = new BlogPost();
$post->title = "Title";
$post->description = "description";
$post->save();
<?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