Kohana_Model_Vocabulary::initialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 14
cts 14
cp 1
rs 9.504
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * @author     Ivan Kerin <[email protected]>
5
 * @copyright  (c) 2014 Clippings Ltd.
6
 * @license    http://spdx.org/licenses/BSD-3-Clause
7
 */
8
class Kohana_Model_Vocabulary extends Jam_Model
9
{
10 1
	public static function initialize(Jam_Meta $meta)
11
	{
12
		$meta
13 1
			->table('vocabularies')
14 1
			->name_key('name');
15
16 1
		$meta->behaviors(array(
17 1
			'paranoid' => Jam::behavior('paranoid', array()),
18
		));
19
20 1
		$meta->associations(array(
21 1
			'terms' => Jam::association('hasmany', array('inverse_of' => 'vocabulary')),
22
		));
23
24 1
		$meta->fields(array(
25 1
			'id' => Jam::field('primary'),
26 1
			'name' => Jam::field('string'),
27
28
			// whether to show / hide the whole vocabulary from the frontend
29 1
			'is_hidden' => Jam::field('boolean', array()),
30
31
			// Analitics
32 1
			'created_at' => Jam::field('timestamp', array('auto_now_create' => TRUE, 'format' => 'Y-m-d H:i:s')),
33 1
			'updated_at' => Jam::field('timestamp', array('auto_now_update' => TRUE, 'format' => 'Y-m-d H:i:s', 'label' => "Last edited")),
34
		));
35
	}
36
}