Evolution #1875
ouvertConsistent use of foreign entries
0%
Description
Foreign key related values are handled differently... Some rely on properties that can be either null
, the id as integer, or even an object instance. Sometimes it's just object instance, other times just the ID...
That's quite hard to understand; and that also can cause issues if we want to rely on an ORM like Doctrine.
- a local property name that uses the
Object::PK
, - another one for the instantiated object; loaded per dependency/on demand.
Some foreign values are only loaded on demand, but some other are always loaded and tha cannot be changed (Title in the Adherent class for example).
Mis à jour par Johan Cwiklinski il y a environ 2 mois
Johan Cwiklinski a écrit :
It must be changed so we have:
- a local property name that uses the
Object::PK
,- another one for the instantiated object; loaded per dependency/on demand.
In facts, maybe not... ORMs work with objects, not their PK value; and this is generally done like that in Galette (there are few inconsistencies to be reviewed and solved though).
But there is also a major specific case: the Adherent
class which does not loads dependencies for performances reasons. In this case, if the dependency is loaded, we have an object instance, and if not, we have the integer PK value for reference (and maybe future load without a query on members table).