mirror of https://github.com/MISP/MISP
38 lines
858 B
PHP
38 lines
858 B
PHP
<?php
|
|
App::uses('AppModel', 'Model');
|
|
|
|
class TaxonomyPredicate extends AppModel
|
|
{
|
|
public $useTable = 'taxonomy_predicates';
|
|
|
|
public $recursive = -1;
|
|
|
|
public $actsAs = array(
|
|
'Containable',
|
|
);
|
|
|
|
public $validate = array(
|
|
'value' => array(
|
|
'rule' => array('stringNotEmpty'),
|
|
),
|
|
'expanded' => array(
|
|
'rule' => array('stringNotEmpty'),
|
|
),
|
|
);
|
|
|
|
public $hasMany = array(
|
|
'TaxonomyEntry' => array(
|
|
'dependent' => true
|
|
)
|
|
);
|
|
|
|
public function beforeValidate($options = array())
|
|
{
|
|
if (empty($this->data['TaxonomyPredicate']['expanded'])) {
|
|
$this->data['TaxonomyPredicate']['expanded'] = $this->data['TaxonomyPredicate']['value'];
|
|
}
|
|
parent::beforeValidate();
|
|
return true;
|
|
}
|
|
}
|