nextras / orm

Orm with clean object design, smart relationship loading and powerful collections.
https://nextras.org/orm
MIT License
310 stars 57 forks source link

Array to string conversion - composite key with OneHasOne #264

Closed namo-R closed 6 years ago

namo-R commented 6 years ago

There is an error, when I try to use primary-proxy & composite key with one has one relationships.

...
 * @property int            $id         {primary-proxy}
 * @property int            $user       {m:1 Users, oneSided=true} {primary}
 * @property Results        $result     {1:1 Results::$result, isMain=true} {primary}
...

Array to string conversion is thrown... at Relationships/HasOne.php:241

$newValue->getValue('id') return an array with persistedId

Condition return (string) $this->getPrimaryValue() !== (string) $newValue->getValue('id'); at Dbal/StorageReflection/StorageReflection.php should also take into account multiple keys and compare the correct key.

hrach commented 6 years ago

Thanks, will take a look at it.

hrach commented 6 years ago

(Though, I am definitely open to pull requests 😉)

hrach commented 6 years ago

Should be fixed by https://github.com/nextras/orm/commit/90c6fa26ce1bbc94a270a3fedbb5eeb696bb850f. Please test it :)