DragonByte Tech
Well-known member
- Affected version
- 2.1.3
Assume an already saved entity from this database table record:
With this relation:
Attempting to call
If the primary key is a singular auto-increment value, and it's 0 in the parent record, then it should not be hydrated.
With this relation:
PHP:
'Address' => [
'entity' => 'Addon:Address',
'type' => self::TO_ONE,
'conditions' => 'address_id',
'primary' => true
],
Attempting to call
$order->getRelationOrDefault('Address')
will produce this server error:
Code:
InvalidArgumentException: Column 'address_id' is read only, can only be set with forceSet in src/XF/Mvc/Entity/Entity.php at line 593
[LIST=1]
[*]XF\Mvc\Entity\Entity->set() in src/XF/Mvc/Entity/Entity.php at line 548
[*]XF\Mvc\Entity\Entity->__set() in src/XF/Mvc/Entity/Manager.php at line 604
[*]XF\Mvc\Entity\Manager->hydrateDefaultFromRelation() in src/XF/Mvc/Entity/Entity.php at line 407
[*]XF\Mvc\Entity\Entity->getRelationOrDefault() in src/addons/path/Admin/Controller/Order.php at line 84
[*]path\Admin\Controller\Order->actionEdit() in src/XF/Mvc/Dispatcher.php at line 321
[*]XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 244
[*]XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
[*]XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
[*]XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2178
[*]XF\App->run() in src/XF.php at line 390
[*]XF::runApp() in admin.php at line 13
[/LIST]
If the primary key is a singular auto-increment value, and it's 0 in the parent record, then it should not be hydrated.
Last edited: