public function populate()
 {
     $_REQUEST['showqueries'] = 0;
     set_time_limit(3600);
     $renderer = DebugView::create();
     $renderer->writeHeader();
     $renderer->writeInfo("Orient Environment Builder: Do not run while logged in as a member", Director::absoluteBaseURL());
     echo "<div class=\"build\">";
     $numTestObjects = 100;
     $content .= "<br /><br />Creating {$numTestObjects} test objects.. <br />";
     for ($i = 0; $i < $numTestObjects; $i++) {
         $rand = rand(1, 10);
         $testObj = new TestObject();
         $testObj->Code = 'orient-test-' . $rand;
         $testObj->Title = 'OrientDB Test ' . $rand;
         $testObj->Sort = 1;
         $testObj->write(false, true, true);
         // $content .= "{$testObj->Title} <br />";
     }
     $content .= "Creating inherited object <br />";
     $child = Family_Child::create();
     $child->update(array('Name' => "Name First", 'Title' => 'Child'));
     $result = $child->write();
     $numPosts = 100;
     $content .= "Creating {$numPosts} posts and authors <br />";
     for ($i = 0; $i < $numPosts; $i++) {
         $rand = rand(1, 9);
         $author = new Person();
         $author->Name = "Person {$rand}";
         $id = $author->write();
         $post = new Post();
         $post->Title = "Post Title {$rand}";
         $post->AuthorID = $id;
         $post->write();
     }
     $numArticles = 100;
     $content .= "Creating {$numArticles} articles and at least as many tags <br />";
     for ($i = 0; $i < $numArticles; $i++) {
         $rand = rand(1, 999);
         $article = new Article();
         $article->Title = "Article {$rand}";
         $id = $article->write();
         $range = array(1, 2);
         foreach ($range as $val) {
             $tag = new Tag();
             $tag->Name = "Tag {$val}";
             $tag->write();
             $article->Tags()->add($tag);
         }
     }
     echo $content;
     echo "</div>";
     $renderer->writeFooter();
 }
 public function populate()
 {
     $renderer = DebugView::create();
     $renderer->writeHeader();
     $renderer->writeInfo("Orient Environment Builder: Do not run while logged in as a member", Director::absoluteBaseURL());
     echo "<div class=\"build\">";
     $content = 'Creating some test objects.. <br /><br />';
     for ($i = 0; $i < 50; $i++) {
         $rand = rand(1, 10);
         $testObj = new TestObject();
         $testObj->Code = 'orient-test-' . $rand;
         $testObj->Title = 'OrientDB Test ' . $rand;
         $testObj->Sort = 1;
         $testObj->write(false, true, true);
         $content .= "{$testObj->Title} <br />";
     }
     echo $content;
     echo "</div>";
     $renderer->writeFooter();
 }