# |
Apr 24th 2017, 09:38 |
birdy247 |
any ideas? |
# |
Apr 24th 2017, 09:35 |
birdy247 |
rather than anyting to suggest its trying to add a new record |
# |
Apr 24th 2017, 09:35 |
birdy247 |
but I always get back a list of results |
# |
Apr 24th 2017, 09:35 |
birdy247 |
I am using POST |
# |
Apr 24th 2017, 09:34 |
birdy247 |
I am trying to ADD a record via my API |
# |
Apr 24th 2017, 09:06 |
theaxiom |
Yo dawg |
# |
Apr 24th 2017, 09:06 |
theaxiom |
Maybe I will use both, haha |
# |
Apr 24th 2017, 09:05 |
Neon1024 |
Well core team recently switched from Coveralls to CodeCov for what it’s worth |
# |
Apr 24th 2017, 09:05 |
theaxiom |
Which is better, codecov or coveralls? |
# |
Apr 24th 2017, 09:03 |
Neon1024 |
But #minor |
# |
Apr 24th 2017, 09:03 |
Neon1024 |
Sometimes index templates are missing associations |
# |
Apr 24th 2017, 09:03 |
Neon1024 |
The RelatedModelsListener needs a little love though imho |
# |
Apr 24th 2017, 09:03 |
theaxiom |
You can also override the methods and then pass back to CRUD when you are done hi-jacking the event. |
# |
Apr 24th 2017, 09:02 |
Neon1024 |
s/event/exception |
# |
Apr 24th 2017, 09:02 |
Neon1024 |
Otherwise crud can’t catch the missing method event |
# |
Apr 24th 2017, 09:02 |
birdy247 |
perfrcto for an API! |
# |
Apr 24th 2017, 09:02 |
birdy247 |
sweet |
# |
Apr 24th 2017, 09:02 |
Neon1024 |
Yep, just without any methods |
# |
Apr 24th 2017, 09:02 |
theaxiom |
https://socialplex.us is built entirely using the CRUD plugins, including crud-users and crud-view as well as bootstrap-ui |
# |
Apr 24th 2017, 09:02 |
birdy247 |
I still have to make a controller though right? |
# |
Apr 24th 2017, 09:02 |
Neon1024 |
Which is what I did for my API |
# |
Apr 24th 2017, 09:02 |
Neon1024 |
You can write your own Crud action class |
# |
Apr 24th 2017, 09:02 |
Neon1024 |
If you really really want to re-use some bespoke stuff |
# |
Apr 24th 2017, 09:01 |
Neon1024 |
I’ve only found a few cases where I’ve needed to |
# |
Apr 24th 2017, 09:01 |
birdy247 |
:) |
# |
Apr 24th 2017, 09:01 |
Neon1024 |
So it’s really easy to sidestep Crud entirely should you need to |
# |
Apr 24th 2017, 09:01 |
Neon1024 |
If that doesn’t work, just write your own controller method! |
# |
Apr 24th 2017, 09:01 |
Neon1024 |
Which is what it’s listeners do |
# |
Apr 24th 2017, 09:01 |
Neon1024 |
So you can hook Crud’s internal events to modify how it works |
# |
Apr 24th 2017, 09:00 |
Neon1024 |
$this->Crud->on(‘beforeFind’, function (Event $event) { $event->getSubject()->query->contain([‘Birdies’]); }); return $this->Crud->execute(); |
# |
Apr 24th 2017, 09:00 |
birdy247 |
:-S |
# |
Apr 24th 2017, 09:00 |
Neon1024 |
Oh yes you would |
# |
Apr 24th 2017, 09:00 |
Neon1024 |
No you would not |
# |
Apr 24th 2017, 08:59 |
birdy247 |
would I used an "event" |
# |
Apr 24th 2017, 08:59 |
Neon1024 |
The easiest way to think of the Crud plugin is like this to me. You have no controllers. So Cake generates a missing controller exception. Crud hijacks that and instead uses events to scaffold a controller action |
# |
Apr 24th 2017, 08:59 |
birdy247 |
or ->formatResults for example |
# |
Apr 24th 2017, 08:59 |
birdy247 |
If I wanted to add a bit more of a complex query |
# |
Apr 24th 2017, 08:59 |
birdy247 |
both :) |
# |
Apr 24th 2017, 08:59 |
Neon1024 |
-_- |
# |
Apr 24th 2017, 08:59 |
Neon1024 |
Oh it, you mean Crud? |
# |
Apr 24th 2017, 08:58 |
Neon1024 |
Thanks, it’s my new haircut |