orm
orm copied to clipboard
[Cycle 2.0] SchemaInterface::TYPECAST_HANDLER
Hi, I have an error Error : Object of classUserId could not be converted to string /app/vendor/cycle/orm/src/Heap/Heap.php:154
All objects were converted to string fine, but I have this error
Insert works correct but when we do syncHeap we get from Node not correct data and transaction fails
public function attach(object $entity, Node $node, array $index = []): void
{
$this->storage->offsetSet($entity, $node);
$role = $node->getRole();
if ($node->hasState()) {
$this->eraseIndexes($role, $node->getData(), $entity);
$data = $node->getState()->getData();
} else {
$data = $node->getData();
}
........
} else {
if (!isset($data[$indexName])) {
continue;
}
$value = (string)$data[$indexName]; <-------------------- converts not stingable objects
$rolePath[$value] = $entity;
}
@roxblnfk Hello, do you have any updates for this bug. I really want to start using cycle 2.0 but this one stop me, thanks
@sergey-telpuk Hello. I have an understanding of the issue and i am saddened to realize that we made it. Right now i'm on my day off and i'm not doing development.
But i have a few solutions:
- As a temporary solution, you can implement a
Stringable
interface in theclassUserId
class. - In the future, when i go back to work, i might adjust the existing Heap to do
cast
/uncast
actions on the Node data, or i might write new Heap for such cases.
In any case, this issue will be resolved, but later