Comments (3)
Weird... I think this may be a case that is not handled. What happens if you add a default @Id @GeneratedValue(strategy="AUTO")
and make your email just a column?
from doctrinemodule.
I use MongoDB ODM (and doctrine-mongo-odm-module), I think that in that case it not important, but may be.
What happens if you add a default @id @GeneratedValue(strategy="AUTO") and make your email just a column?
All works nice, if I add some ID in my class and make email field string. Hydration not works if you try hydrate array which contain entity IDs and entity was not found in database by this IDs (at least as I understand).
I think problem in DoctrineModule\Stdlib\Hydrator\DoctrineObject::tryConvertArrayToObject:
protected function tryConvertArrayToObject($data, $object)
{
$identifierNames = $this->metadata->getIdentifierFieldNames($object);
$identifierValues = array();
if (empty($identifierNames)) {
return $object;
}
foreach ($identifierNames as $identifierName) {
if (!isset($data[$identifierName]) || empty($data[$identifierName])) {
return $object;
}
$identifierValues[$identifierName] = $data[$identifierName];
}
return $this->find(get_class($object), $identifierValues);
}
Maybe last line need to be replaced by:
if ( $existingEntity = $this->find(get_class($object), $identifierValues) ) {
return $existingEntity;
}
return $object;
I am not completely sure. But it will fix the error =)
from doctrinemodule.
I will close this one since the entire hydrator has been rewritten. Please verify against latest version (0.7.0
as of current date)
from doctrinemodule.
Related Issues (20)
- vendor/bin/doctrine-module only works if it's a symlink HOT 12
- Unit tests should be executed with PHP 8.0 HOT 1
- Pushed breaking change in 4.2 release HOT 4
- incompatible with doctrine/orm >= 2.12.0 HOT 3
- Missing Versions on Packagist HOT 2
- Deprecate doctrine/cache HOT 8
- Release 5.3.0 with PHP 8.2 Support HOT 5
- Can't install due to conflicting requirements HOT 25
- Current CLI implementation triggers api-tools-mvc-auth events HOT 2
- 6.0.2 regex change is too restrictive HOT 6
- Missing requirement in composer.json HOT 2
- Migration to v6 leads to cache issues HOT 11
- Authentication Error when no credentialCallable is given. HOT 5
- Allow cleanSearchValue method to accept an integer HOT 4
- Mapping error doctrine find, findOneBy, findBy. HOT 1
- Package incorrectly states that it does provide `laminas/laminas-cache-storage-implementation` HOT 3
- Bump to PHP 8.3 ? HOT 3
- orm3 compatibility HOT 1
- Implement CacheItemPoolInterface
- Upgrade to ServiceManager 4 HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctrinemodule.