Esempio n. 1
0
 /**
  * Returns a model for a bean based on its type.
  *
  * @param OODBBean $bean
  *
  * @return object
  */
 public function getModelForBean(\RedBeanPHP\OODBBean $bean)
 {
     if ($bean->getMeta('type') === 'meal') {
         $model = new Model_Soup();
         $model->loadBean($bean);
         return $model;
     } else {
         return parent::getModelForBean($bean);
     }
 }
Esempio n. 2
0
 /**
  * Test type hinting with boxed model
  *
  * @param Model_Soup $soup
  */
 private function giveMeSoup(\Model_Soup $soup)
 {
     asrt($soup instanceof \Model_Soup, TRUE);
     asrt('A bit too salty', $soup->taste());
     asrt('tomato', $soup->flavour);
 }