Re: Using event system

15 views
Skip to first unread message
Message has been deleted
Message has been deleted
Message has been deleted

gabor

unread,
Nov 15, 2015, 6:24:53 PM11/15/15
to redbeanphp
Technically this is possible, but RedBeanPHP has not been designed this way so you might encounter unexpected behaviours.
However if you feel adventurous, the first thing you have to do is to load the bean into the model:

$model->loadBean($bean);

Hope this helps a bit,

cheers,
Gabor

On Sunday, November 15, 2015 at 11:55:19 PM UTC+1, Mike Whiting wrote:

By the way I have just tried using $bean = $modelfoo->unbox() but that is returning null...


On 15/11/2015 21:36, Mike Whiting wrote:


Sorry.. I jumped the gun a bit.  I just found the docs page on models: http://redbeanphp.com/models.

My other question though is if it's possible/valid to get hold of a bean by instantiating a model directly.  i.e.

$bean = new Model_Foo();

The reason I'm asking is because I'm interested in integrating redbean with the alice fixture generation tool, which I'm not sure has a way of overriding the default mechanism for instantiating models. I.e. bypassing the R fascade dispense method.

Cheers,


On 15/11/2015 21:23, Mike Whiting wrote:

I appoligise for this seeminly lazy approach in asking the question but I wrote this blog post about taking advantage of Redbean's event system to create model layer code that is run upon bean creation (dispense).  Can  somone please explaon how the same can be achieved with the latest version of Redbean?

The original post is here: https://mikewhiting.co/2013/mar/13/redbeanmodels

Many thanks,



--

Mike Whiting
Director

Ai-em Ltd
17 Fieldway, West Sussex, RH16 2DD

Tel: +44(0)7990 570581
Web: ai-em.net


--

Mike Whiting
Director

Ai-em Ltd
17 Fieldway, West Sussex, RH16 2DD

Tel: +44(0)7990 570581
Web: ai-em.net


--

Mike Whiting
Director

Ai-em Ltd
17 Fieldway, West Sussex, RH16 2DD

Tel: +44(0)7990 570581
Web: ai-em.net

Reply all
Reply to author
Forward
0 new messages