Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Virtual Fields on Model

Hi,

I've got a Base Modul Model that I call in a frontend controller like this:

$this->vars['product'] = $this->products_model->find_one(['id' => $id]);

And now I want to add some additional data from a 3rd party API, to pass down to the template (specs does not exist in the db):

$this->vars['product']->specs = [ /*...*/ ];
$this->fuel->pages->render('detail', $this->vars);

Is that possible to add fields that then can be accessed like all other record objects (with formatters etc)?

Does that make sense?

Comments

Sign In or Register to comment.