I am tying to create API with RedBeanPHP and I have following case: Have to find all records from table with name "my_data01"
R::findAll( 'my_data01' );
But my model class have name 'Product.php' which contains of
class Product extends SimpleModel
{
public $attributes = array();
public function dispense() {}
...//other methods
}
I want to somehow wrap my table "my_data01" inside bean (may be) that has name Product. and when using code like:
R::findAll( 'product' );
It will query "my_data01" table. How can i do that? thnx
also a have used define( 'REDBEAN_MODEL_PREFIX', 'myapp\\' ) for corecctly loadyng model for current bean
You can't do that in RedBean. The ORM is intrinsically linked to its own data structure. I'd suggest importing
my_data01into a new table calledproduct. Indeed, the manual for RedBean states:Your other alternative of course, is to use another ORM which offers more flexibility, for example Doctrine or Eloquent.