<?php include '../rolisz.php'; rolisz::connect('MySQLi', 'localhost', 'root', '', 'rolisz'); include '../db.php'; table::set('posts'); table::addRelationM2MS('posts', 'post_category', 'id', 'pid', 'category', 'id', 'cid'); table::addRelationM2MS('posts', 'post_tags', 'id', 'pid', 'tags', 'id', 'tid'); table::addRelationS('posts', 'users', 'author', 'id'); table::addRelationS('posts', 'comments', 'pid'); //var_dump(table::findS('posts')); $posts = new table('posts'); // $posts->addRelationM2M('post_category','id','pid','category','id','cid'); // $posts->addRelation('users','author','id'); // $posts->addRelation('comments','pid'); $posts->title = 'Test Post'; $posts->body = 'Lorem Ipsum Doloret coloret'; $posts->author = 1; //$posts->save(); $posts1 = new table('posts', 1); $test = $posts1->find('category'); $comment = new table('comments', 1); $comment->posts(array('id' => 1)); $comment->save(); $author = new table('users', 1); $posts2 = new table('posts', 2); $posts2->tags(array('tag' => 'google'));
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ public static function setUpBeforeClass() { rolisz::connect('MySQLi', 'localhost', 'root', '', 'test'); }
<?php include '../rolisz.php'; rolisz::connect('MySQLi', 'localhost', 'root', '', 'wordpress'); include '../db.php'; $posts = new table('wpb_posts', '59'); $posts->addRelationM2M('wpb_term_relationships', 'id', 'object_id', 'wpb_terms', 'term_id', 'term_taxonomy_id'); $posts->addRelation('wpb_users', 'post_author', 'ID'); $posts->addRelation('wpb_comments', 'comment_post_ID'); $term_rel = new table('wpb_terms'); $term_rel->addRelation('wpb_term_taxonomy', 'term_id'); //$posts->save(); $test = $posts->find('wpb_posts', array('wpb_terms' => array('wpb_term_taxonomy' => array('taxonomy' => 'category'), 'name' => 'Customization'))); var_dump($test); echo 'yooooo'; $test = $posts->find('wpb_terms'); var_dump($test);