Exemple #1
0
 /**
  * facade method for Cooker Graph.
  *
  * @param array   $array            array containing POST/GET fields or other data
  * @param boolean $filterEmptyBeans whether you want to exclude empty beans
  *
  * @return array $arrayOfBeans Beans
  */
 public static function graph($array, $filterEmpty = false)
 {
     $cooker = new RedBean_Cooker();
     $cooker->setToolbox(self::$toolbox);
     return $cooker->graph($array, $filterEmpty);
 }
Exemple #2
0
$id = R::store(reset($playList));
$play = R::load("playlist", $id);
asrt(count($play->ownTrack), 2);
foreach ($play->ownTrack as $track) {
    asrt(count($track->sharedSong), 1);
    asrt($track->cover instanceof RedBean_OODBBean, true);
}
$track = reset($play->ownTrack);
$song = reset($track->sharedSong);
asrt(intval($song->id), 1);
asrt($song->url, "music.com.harlem");
$json = '{"mysongs":{"type":"playlist","id":"1","ownTrack":[{"type":"track","name":"harlem nocturne","order":"1","sharedSong":[{"type":"song","id":"1","url":"changedurl"}],"cover":{"type":"cover","id":"2"}},{"type":"track","name":"brazil","order":"2","sharedSong":[{"type":"song","url":"music.com\\/djan"}],"cover":{"type":"cover","url":"picasa\\/django"}}]}}';
$playList = json_decode($json, true);
$cooker = new RedBean_Cooker();
$cooker->setToolbox(R::$toolbox);
$playList = $cooker->graph($playList);
$id = R::store(reset($playList));
$play = R::load("playlist", $id);
asrt(count($play->ownTrack), 2);
foreach ($play->ownTrack as $track) {
    asrt(count($track->sharedSong), 1);
    asrt($track->cover instanceof RedBean_OODBBean, true);
}
$track = reset($play->ownTrack);
$song = reset($track->sharedSong);
asrt(intval($song->id), 1);
asrt($song->url, "changedurl");
//Tree
$page = R::dispense('page');
$page->name = 'root of all evil';
list($subPage, $subSubPage, $subNeighbour, $subOfSubNeighbour, $subSister) = R::dispense('page', 5);