-
Notifications
You must be signed in to change notification settings - Fork 1
/
Listener.php
31 lines (27 loc) · 911 Bytes
/
Listener.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace VersoBit\ResourceTickets;
use XF\Mvc\Entity\Entity;
class Listener
{
public static function resourceItemEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure)
{
$structure->columns['ticket_id'] = ['type' => Entity::UINT, 'default' => 0];
$structure->relations['Ticket'] = [
'entity' => 'NF\Tickets:Ticket',
'type' => Entity::TO_ONE,
'conditions' => 'ticket_id',
'primary' => true
];
}
public static function ticketEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure)
{
$structure->relations['Resource'] = [
'entity' => 'XFRM:ResourceItem',
'type' => Entity::TO_ONE,
'conditions' => [
['ticket_id', '=', '$ticket_id']
],
'key' => 'ticket_id'
];
}
}