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

Unique key updating entity #238

Open manelj opened 7 years ago

manelj commented 7 years ago

I think that if i update an entity changing the value of an "unique" field, save system does not check unique integrity.

nebulousGirl commented 7 years ago

You are right. The validation of the unique constraint is limited to new entities: https://github.com/spotorm/spot2/blob/master/lib/Mapper.php#L1125

I don't know if there is a reason being that, but the code should still be failing at the database level with an exception.