I would like to retrieve some records of a linked table :
table "portfolio" :
-id
-title
table "portfolio_img" :
-id
-image
-id_portfolio
The {id_portfolio} field is the foreign key of the “portfolio” table : {id} field.
How can I get all the "portfolio_img" records using an {id_portfolio} field (not using the classic way of R::find(), of course 😉 ) ?
Regards
The way redbean is designed, you would need to rename the field to
portfolio_id. Then you would be able to access all the images by calling theportfoliobean and theownattribute.Now you can add an image as well, using:
I do a similar thing in my scripts (one to many – Company to Contacts).