Kohana_Model_Auth_Role::initialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 0
cts 11
cp 0
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php defined('SYSPATH') OR die('No direct access allowed.');
2
/**
3
 * Default auth role
4
 *
5
 * @package	   Kohana/Auth
6
 * @author     Ivan Kerin
7
 * @copyright  (c) 2011-2012 Despark Ltd.
8
 * @author	   creatoro
9
 * @copyright  (c) 2011 creatoro
10
 * @license	   http://creativecommons.org/licenses/by-sa/3.0/legalcode
11
 */
12
class Kohana_Model_Auth_Role extends Jam_Model {
13
14
	public static function initialize(Jam_Meta $meta)
15
	{
16
		$meta
17
			->name_key('name')
18
19
			->fields(array(
20
				'id' => Jam::field('primary'),
21
				'name' => Jam::field('string'),
22
				'description' => Jam::field('string'),
23
			))
24
25
			->associations(array(
26
				'users' => Jam::association('manytomany'),
27
			))
28
29
			->validator('name', array('present' => TRUE, 'length' => array('minimum' => 4, 'maximum' => 32), 'unique' => TRUE))
30
			->validator('description', array('length' => array('maximum' => 255)));
31
32
	}
33
} // End Kohana_Model_Auth_Role