5 use RedBeanPHP\OODBBean as OODBBean;
9 * Base Model For All RedBeanPHP Models using FUSE.
11 * RedBeanPHP FUSE is a mechanism to connect beans to posthoc
12 * models. Models are connected to beans by naming conventions.
13 * Actions on beans will result in actions on models.
15 * @file RedBeanPHP/SimpleModel.php
16 * @author Gabor de Mooij and the RedBeanPHP Team
20 * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
21 * This source file is subject to the BSD/GPLv2 License that is bundled
22 * with this source code in the file license.txt.
32 * Used by FUSE: the ModelHelper class to connect a bean to a model.
33 * This method loads a bean in the model.
35 * @param OODBBean $bean bean to load
39 public function loadBean( OODBBean $bean )
45 * Magic Getter to make the bean properties available from
48 * @note this method returns a value, not a reference!
49 * To obtain a reference unbox the bean first!
51 * @param string $prop property to get
55 public function __get( $prop )
57 return $this->bean->$prop;
62 * Sets the value directly as a bean property.
64 * @param string $prop property to set value of
65 * @param mixed $value value to set
69 public function __set( $prop, $value )
71 $this->bean->$prop = $value;
75 * Isset implementation.
76 * Implements the isset function for array-like access.
78 * @param string $key key to check
82 public function __isset( $key )
84 return isset( $this->bean->$key );
88 * Box the bean using the current model.
89 * This method wraps the current bean in this model.
90 * This method can be reached using FUSE through a simple
91 * OODBBean. The method returns a RedBeanPHP Simple Model.
92 * This is useful if you would like to rely on PHP type hinting.
93 * You can box your beans before passing them to functions or methods
94 * with typed parameters.
104 * Unbox the bean from the model.
105 * This method returns the bean inside the model.
109 public function unbox()