There is a warning message when using upload behavior on a model with composite primary key
melbreaker opened this issue · 2 comments
melbreaker commented
The file is uploaded correctly but with a warning message. If I remove a composite primary key and make it a single primary key, the warning message is gone.
This is a configuration of my ModelTable.
$this->setPrimaryKey(['id', 'member_id']);
$this->addBehavior('Josegonzalez/Upload.Upload', [
'logo' => [
'fields' => [
'dir' => 'logo_dir',
'size' => 'logo_size',
'type' => 'logo_type'
],
'nameCallback' => function ($table, $entity, $data, $field, $settings) {
return strtolower($data['name']);
},
'keepFilesOnDelete' => false
]
]);
Warning Message
Warning: Warning (2): Illegal offset type in isset or empty in [/vendor/cakephp/cakephp/src/Datasource/EntityTrait.php, line 675]
Request URL: /api/businesses/edit
Client IP: 127.0.0.1
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE/src/Error/BaseErrorHandler.php, line 159
Cake\Core\BasePlugin::{closure}() - ROOT/vendor/cakephp/debug_kit/config/bootstrap.php, line 42
Cake\ORM\Entity::_accessor() - CORE/src/Datasource/EntityTrait.php, line 675
Cake\ORM\Entity::get() - CORE/src/Datasource/EntityTrait.php, line 287
Josegonzalez\Upload\File\Path\DefaultProcessor::basepath() - ROOT/vendor/josegonzalez/cakephp-upload/src/File/Path/Basepath/DefaultTrait.php, line 31
Josegonzalez\Upload\Model\Behavior\UploadBehavior::beforeSave() - ROOT/vendor/josegonzalez/cakephp-upload/src/Model/Behavior/UploadBehavior.php, line 100
Cake\Event\EventManager::_callListener() - CORE/src/Event/EventManager.php, line 353
Cake\Event\EventManager::dispatch() - CORE/src/Event/EventManager.php, line 330
Cake\ORM\Table::dispatchEvent() - CORE/src/Event/EventDispatcherTrait.php, line 114
Cake\ORM\Table::_processSave() - CORE/src/ORM/Table.php, line 1986
Cake\ORM\Table::Cake\ORM\{closure}() - CORE/src/ORM/Table.php, line 1920
Cake\ORM\Table::Cake\ORM\{closure}() - CORE/src/ORM/Table.php, line 1634
Cake\Database\Connection::transactional() - CORE/src/Database/Connection.php, line 738
Cake\ORM\Table::_executeTransaction() - CORE/src/ORM/Table.php, line 1635
Cake\ORM\Table::save() - CORE/src/ORM/Table.php, line 1921
App\Controller\Api\BusinessesController::edit() - APP/Controller/Api/BusinessesController.php, line 75
Cake\Controller\Controller::invokeAction() - CORE/src/Controller/Controller.php, line 610
Cake\Http\ActionDispatcher::_invoke() - CORE/src/Http/ActionDispatcher.php, line 120
Cake\Http\ActionDispatcher::dispatch() - CORE/src/Http/ActionDispatcher.php, line 94
Cake\Http\BaseApplication::__invoke() - CORE/src/Http/BaseApplication.php, line 235
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Routing\Middleware\RoutingMiddleware::__invoke() - CORE/src/Routing/Middleware/RoutingMiddleware.php, line 162
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Routing\Middleware\AssetMiddleware::__invoke() - CORE/src/Routing/Middleware/AssetMiddleware.php, line 88
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Error\Middleware\ErrorHandlerMiddleware::__invoke() - CORE/src/Error/Middleware/ErrorHandlerMiddleware.php, line 96
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
DebugKit\Middleware\DebugKitMiddleware::__invoke() - ROOT/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php, line 53
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Http\Runner::run() - CORE/src/Http/Runner.php, line 51
Cake\Http\Server::run() - CORE/src/Http/Server.php, line 98
[main] - ROOT/webroot/index.php, line 40
saeideng commented
entity::get()
does not support array
saeideng commented
@melbreaker could you test #515 ?