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

Retrieving/Removing entity by composite PK #290

Closed hrach closed 6 years ago

hrach commented 6 years ago

$repository->getById(['object' => 591, 'image' => 1357]); is not working array_combine() expects parameter 2 to be array, integer given

hrach commented 6 years ago

This reported bug was not actually such bug, because the reporter has wrongly defined entity, something like (note the $id type)

/**
 * @property int               $id        {primary-proxy}
 * @property Tag               $tag       {m:1 Tag::$tagFollowers} {primary}
 * @property Author            $author    {m:1 Author::$tagFollowers} {primary}
 */

// instead

/**
 * @property array             $id        {primary-proxy}
 * @property Tag               $tag       {m:1 Tag::$tagFollowers} {primary}
 * @property Author            $author    {m:1 Author::$tagFollowers} {primary}
 */

which let not to processing the input here: https://github.com/nextras/orm/blob/644f806dad109ec72ab18a5b0ec8512a6f0d13e5/src/Mapper/Dbal/QueryBuilderHelper.php#L110-L112

and subsequently caused the warning.