weixin_39643244 2020-11-30 14:29
浏览 0

Alternative syntax

Hello, i have some suggestions about redbean syntax.

Currently it's invoked like this:


$product = R::dispense('product');
$product->price = 50;
R::store($product);
R::trash($product);  

But i think it would make more sense to be invoked like this:


$product = new RedBean('product');
$product->price = 50;
$product->store();
$product->trash();

Loading can be done like this:


$product = new RedBean('product')->load($id);
//or this: (both should work)
$product = new RedBean('product');
$product->load($id);

I believe that both of these can be implemented concurently, so user can choose whatever he likes more. I personally prefer the second one much more. It should be very simple to implement. Like few lines of code. Thanks.

该提问来源于开源项目:gabordemooij/redbean

  • 写回答

0条回答 默认 最新

    报告相同问题?