chg: add all Event relationships

pull/9540/head
Luciano Righetti 2024-02-06 14:37:15 +01:00
parent c663661abb
commit 8040cf57a5
1 changed files with 76 additions and 0 deletions

View File

@ -18,6 +18,34 @@ class EventsTable extends AppTable
parent::initialize($config);
$this->addBehavior('AuditLog');
$this->belongsTo(
'User',
[
'className' => 'Users',
'foreignKey' => 'user_id'
]
);
$this->belongsTo(
'ThreatLevel',
[
'className' => 'ThreatLevels',
'foreignKey' => 'threat_level_id'
]
);
$this->belongsTo(
'Org',
[
'className' => 'Organisations',
'foreignKey' => 'org_id'
]
);
$this->belongsTo(
'Orgc',
[
'className' => 'Organisations',
'foreignKey' => 'orgc_id'
]
);
$this->belongsTo(
'SharingGroup',
[
@ -25,6 +53,7 @@ class EventsTable extends AppTable
'foreignKey' => 'sharing_group_id'
]
);
$this->hasMany(
'Attributes',
[
@ -32,6 +61,53 @@ class EventsTable extends AppTable
'propertyName' => 'Attribute'
]
);
$this->hasMany(
'ShadowAttributes',
[
'dependent' => true,
'propertyName' => 'ShadowAttribute'
]
);
$this->hasMany(
'Objects',
[
'dependent' => true,
'propertyName' => 'Object',
'className' => 'MispObjects',
]
);
$this->hasMany(
'EventTags',
[
'dependent' => true,
'propertyName' => 'EventTag',
]
);
$this->hasMany(
'Sightings',
[
'dependent' => true,
'propertyName' => 'Sighting',
]
);
$this->hasMany(
'EventReports',
[
'dependent' => true,
'propertyName' => 'EventReport',
]
);
$this->hasMany(
'CryptographicKeys',
[
'dependent' => true,
'propertyName' => 'CryptographicKey',
'foreignKey' => 'parent_id',
'conditions' => [
'parent_type' => 'Events'
],
]
);
$this->setDisplayField('title');
}