XF 2.0 Entity relations and isChanged on a field used in the relation

DragonByte Tech

Well-known member
Sorry for the poor title :(

If I have this relation:
PHP:
            'License' => [
                'entity' => 'DBTech\eCommerce:License',
                'type' => self::TO_ONE,
                'conditions' => [
                    ['license_id', '=', '$license_id']
                ],
                'primary' => true
            ],

And the license_id field changes, can I use $this->License in the _preSave function to access the new License entity, or should I go via the EntityManager?


Fillip
 
Looking into this, it seems as if I can use $this->License in the _preSave function only during an update operation. The relation isn't created anywhere until the entity is saved.


Fillip
 
Top Bottom