Ejemplo n.º 1
0
$author->country = "PY";
$author->save();
/* Add one blog post */
$post = new PostModel();
$post->uri = "/hello-world";
$post->title = "Hello World";
$post->author = $author->getID();
/* add one comment */
$post->add_comment("testing", "*****@*****.**", "testing comment");
$post->save();
/* add another comment */
$post->add_comment("testing", "*****@*****.**", "cool post");
$post->save();
for ($i = 0; $i < 1000; $i++) {
    /* Add another post */
    $post->reset();
    /* reet the post object */
    $post->uri = "/" . uniqid();
    $post->title = "Yet another post ({$i})";
    $post->author = $author->getID();
    $post->save();
}
/* Clean up the current the resultset */
/* same as $post = null; $post = new Post Model */
/* but more efficient */
$post->reset();
$post->where('author', $author->getID());
foreach ($post as $bp) {
    var_dump("Author: " . $bp->author_name);
}
$author->name = "cesar d. rodas";