<?php
namespace App // if this line is commented, everything works as expected
{
require 'rb.php';
// setup
\R::setup("mysql:host=localhost;dbname=application", 'root', '');
// this doesn't work inside "App" namespace
class Model_Band extends \RedBean_SimpleModel
{
public function update()
{
echo __METHOD__,'<hr>';
if ( count( $this->bean->ownMember ) >4 )
throw new Exception( 'Too many members!' );
}
}
// test model-fuse methods
list( $band, $members ) = \R::dispenseAll( 'band,member*5' );
$band->ownMember = $members;
\R::store( $band ); // will trigger exception (not inside App namespace)
}