← Back to team overview

phpdevshell team mailing list archive

Re: [Question #220625]: Need more RedBeanPHP tutorials

 

Question #220625 on PHPDevShell changed:
https://answers.launchpad.net/phpdevshell/+question/220625

Description changed to:
I am curious how models/FUSE will work with the built-in ORM?  Is it as
simple as include('redbeanmodel.php'); and firing off queries or is
there more to it?  I just want to correct use the intended built-in
feature so additional tutorials on how to utilize this ORM would be
helpful!

I was thinking something along the lines of:

<?php
    // Hello world heading.
    echo "<h1>Hello, world!</h1>";
 
    // Call ORM plugin.
   include('redbeanmodel.php');
    $this->factory('orm');
 
    // Do the query
    $books = R::find('example_book');
?>

In redbeanmodel.php:
class Model_example_book extends RedBean_SimpleModel {
        public function update() {
            if (count($this->ownBooks)>4) {
                throw new Exception('too many!');
            }
        }
    }

and how would you "freeze" RedBeanPHP in PHPDevShell?

-- 
You received this question notification because you are a member of
PHPDevShell, which is an answer contact for PHPDevShell.