API Prefix routing error
spacebiscuit opened this issue · 1 comments
spacebiscuit commented
When using an API prefix routing the plugin doesn't seem to work:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null
My table class:
$this->addBehavior('Muffin/Footprint.Footprint', [
'events' => [
'Model.beforeSave' => [
'user_id' => 'new',
]
]
]);
My ApiAppController:
namespace App\Controller\Api;
use App\Controller\AppController;
use Cake\Event\Event;
use Muffin\Footprint\Auth\FootprintAwareTrait;
use Cake\Core\Exception\Exception;
class ApiAppController extends \App\Controller\AppController {
use \Crud\Controller\ControllerTrait;
use FootprintAwareTrait;
Without the API prefix routing the user_id is saved and the error does not fire.
spacebiscuit commented
I was missing parent::initialize()in my apiappcontroller