grantus
Active member
This is part of my Entity:
I want to add this to my relations:
But the issue I'm facing is this: 'entity' => 'Battles\ILL:BiuArchives' will depend on what the 'category' is in the $structure->columns.
For example how can I figure out if the column value is something like 'BiuArchives' or 'BthisArchives'?
Code:
$structure->columns = [
'battle_id' => ['type' => self::UINT, 'autoIncrement' => true],
'battle_date' => ['type' => self::UINT, 'default' => 0],
'category' => ['type' => self::STR, 'default' => '', 'maxLength' => 15],
'battle' => ['type' => self::UINT, 'default' => 0],
'user_id' => ['type' => self::UINT, 'default' => 0],
'username' => ['type' => self::STR, 'default' => '', 'maxLength' => 50],
'points' => ['type' => self::UINT, 'default' => 0, 'maxLength' => 5],
'winner' => ['type' => self::STR, 'default' => 'no', 'maxLength' => 3],
];
$structure->relations = [
'User' => [
'entity' => 'XF:User',
'type' => self::TO_ONE,
'conditions' => 'user_id',
'primary' => true
],
];
I want to add this to my relations:
Code:
$structure->relations = [
'Cat' => [
'entity' => 'Battles\ILL:BiuArchives',
'type' => self::TO_ONE,
'conditions' => 'battle'
],
];
But the issue I'm facing is this: 'entity' => 'Battles\ILL:BiuArchives' will depend on what the 'category' is in the $structure->columns.
For example how can I figure out if the column value is something like 'BiuArchives' or 'BthisArchives'?