[BeanCan Resty] Correct way to extend rest methods
53 views
Skip to first unread message
Dario Marotta
unread,
Apr 24, 2022, 10:12:05 AM4/24/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redbeanphp
As in subject, i'd like to add some rest apis to beanCan, for example make it call a CSVimport extension (something like R::CSVimport($data))
Which should be the correct way to add my custom calls? Should i extend \RedBeanPHP\SimpleModel ?
In some case, the subject af the call would not be a bean (see CSVimport example)
The rest url could be something like this:
POST => {site_id}/{table_name}/csv_import (acccepts an array containing csv data)
Dario Marotta
unread,
May 16, 2022, 6:14:59 AM5/16/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redbeanphp
UP for this subject!
gabor
unread,
May 21, 2022, 4:57:16 AM5/21/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redbeanphp
You can extend the BeanCan with standard OOP techniques. However some of the methods are private, which is a mistake. You need to turn those methods to protected to be able to override them.
Another option would be to wrap the BeanCan object in your own class.
cheers
Gabor
Dario Marotta
unread,
May 21, 2022, 6:47:13 AM5/21/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redbeanphp
Could you show me a short example of OOP extension please?
gabor
unread,
May 22, 2022, 5:55:26 AM5/22/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message