Open RodolfoPichardo opened 2 years ago
Hey there,
I've been having a look at this, but I'm not able to see any issues with the Records, on either the Custom Module or the Users Module
I've tried:
Is there another issue here, that I have perhaps misunderstood? (ie: Being unable to navigate to the User record by clicking the Relate field, ie: #30 )
Would you be able to give some more information or more in-depth steps to replicate for this? I'm not sure I'm 100% clear on this issue.
(ie: Specific Fields to Edit, or specific Navigation used)
Thanks!
The problem happens when we save a record from the Staff module, more specifically it has a problem with the relation named pkg1_staff_usersusers_idb
It gives us the error message with this stacktrace:
{
"errors": [{
"debugMessage": "Warning: Invalid argument supplied for foreach()",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [{
"line": 2,
"column": 3
}],
"path": ["saveRecord"],
"trace": [{
"file": "\/webroot\/SuiteCRM-8.1\/public\/legacy\/include\/portability\/ApiBeanMapper\/ApiBeanMapper.php",
"line": 393,
"call": "LineItemMapper::toBean()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/public\/legacy\/include\/portability\/ApiBeanMapper\/ApiBeanMapper.php",
"line": 153,
"call": "ApiBeanMapper::mapLinkFieldToBean()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/core\/backend\/Data\/LegacyHandler\/RecordHandler.php",
"line": 267,
"call": "ApiBeanMapper::toBean()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/core\/backend\/Data\/LegacyHandler\/RecordHandler.php",
"line": 240,
"call": "App\\Data\\LegacyHandler\\RecordHandler::setFields()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/core\/backend\/Process\/DataPersister\/RecordDataPersister.php",
"line": 68,
"call": "App\\Data\\LegacyHandler\\RecordHandler::saveRecord()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/api-platform\/core\/src\/DataPersister\/ChainDataPersister.php",
"line": 59,
"call": "App\\Process\\DataPersister\\RecordDataPersister::persist()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/api-platform\/core\/src\/Bridge\/Symfony\/Bundle\/DataPersister\/TraceableChainDataPersister.php",
"line": 58,
"call": "ApiPlatform\\Core\\DataPersister\\ChainDataPersister::persist()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/api-platform\/core\/src\/GraphQl\/Resolver\/Stage\/WriteStage.php",
"line": 59,
"call": "ApiPlatform\\Core\\Bridge\\Symfony\\Bundle\\DataPersister\\TraceableChainDataPersister::persist()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/api-platform\/core\/src\/GraphQl\/Resolver\/Factory\/ItemMutationResolverFactory.php",
"line": 122,
"call": "ApiPlatform\\Core\\GraphQl\\Resolver\\Stage\\WriteStage::__invoke()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 632,
"call": "ApiPlatform\\Core\\GraphQl\\Resolver\\Factory\\ItemMutationResolverFactory::ApiPlatform\\Core\\GraphQl\\Resolver\\Factory\\{closure}()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 555,
"call": "GraphQL\\Executor\\ReferenceExecutor::resolveOrError()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 478,
"call": "GraphQL\\Executor\\ReferenceExecutor::resolveField()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 921,
"call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}()"
}, {
"call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 923,
"function": "array_reduce()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 494,
"call": "GraphQL\\Executor\\ReferenceExecutor::promiseReduce()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 256,
"call": "GraphQL\\Executor\\ReferenceExecutor::executeFieldsSerially()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php",
"line": 208,
"call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/Executor\/Executor.php",
"line": 155,
"call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/GraphQL.php",
"line": 158,
"call": "GraphQL\\Executor\\Executor::promiseToExecute()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/webonyx\/graphql-php\/src\/GraphQL.php",
"line": 90,
"call": "GraphQL\\GraphQL::promiseToExecute()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/api-platform\/core\/src\/GraphQl\/Executor.php",
"line": 34,
"call": "GraphQL\\GraphQL::executeQuery()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/api-platform\/core\/src\/GraphQl\/Action\/EntrypointAction.php",
"line": 86,
"call": "ApiPlatform\\Core\\GraphQl\\Executor::executeQuery()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 157,
"call": "ApiPlatform\\Core\\GraphQl\\Action\\EntrypointAction::__invoke()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 79,
"call": "Symfony\\Component\\HttpKernel\\HttpKernel::handleRaw()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/vendor\/symfony\/http-kernel\/Kernel.php",
"line": 195,
"call": "Symfony\\Component\\HttpKernel\\HttpKernel::handle()"
}, {
"file": "\/webroot\/SuiteCRM-8.1\/public\/index.php",
"line": 65,
"call": "Symfony\\Component\\HttpKernel\\Kernel::handle()"
}]
}],
"data": {
"saveRecord": null
}
}
We also have a workflow that updates the User record when the Staff module get updated, however, neither the Staff record nor the User record gets updated.
Hello @RodolfoPichardo,
Could you, please clarify for me, are still able to replicate this issue on the most recent versions of SuiteCRM 8?
Thanks in advance!
Regards, Serhii
We have a custom module Staff (pkg1_staff) that has a one to one relationship with Users.
We can create a staff record and it correctly links the id with the users id and both are in pkg1_staff_users_c
Issue
When we try to update a Staff record, it fails in LineItemMapper.php::toBean function because the correct user id is passed in, but it is not an array nor a map with [‘id’,‘idvalue’]
It looks like the code is iterating over all the fields in the Staff record. If fails when it gets to the ID of the related Users record.
Possible Fix
We added this temporary code that solves the issue on LineItemMapper.php toBean function
But, I dont think it should be necessary to do so.
Steps to Reproduce
Your Environment