spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

Fix for alias mapping bug #258

Closed FlipEverything closed 6 years ago

FlipEverything commented 6 years ago

lib/Mapper.php

If we have an entity defined with field alias mapping then in the $data array the value will be referenced by the aliased name. After the array_intersect_key($data, $fields) filter it seems that the aliased column is not in the entity definition, but that is not true.

I provided tests for this bug in my first commit and after applying my patch in the second commit the tests passed successfully.

You can find more details inside the mentioned issues (#237, #145).