Kohana_Model_Shipping_Method::initialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * @package    openbuildings\shipping
5
 * @author     Ivan Kerin <[email protected]>
6
 * @copyright  (c) 2013 OpenBuildings Ltd.
7
 * @license    http://spdx.org/licenses/BSD-3-Clause
8
 */
9
class Kohana_Model_Shipping_Method extends Jam_Model {
10
11
	/**
12
	 * @codeCoverageIgnore
13
	 */
14
	public static function initialize(Jam_Meta $meta)
15
	{
16
		$meta
17
			->associations(array(
18
				'brand' => Jam::association('belongsto', array('inverse_of' => 'shipping_methods')),
19
				'shippings' => Jam::association('manytomany', array(
20
					'foreign_key' => 'method_id',
21
					'join_table' => 'shipping_groups',
22
					'readonly' => TRUE,
23
				)),
24
				'shipping_groups' => Jam::association('hasmany', array('inverse_of' => 'method')),
25
			))
26
			->fields(array(
27
				'id'         => Jam::field('primary'),
28
				'name'       => Jam::field('string'),
29
			))
30
			->validator('name', array('present' => TRUE));
31
	}
32
}
33