Passed
Push — master ( de3595...5928a0 )
by dima
05:09
created

UserAddressMapper::createEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/*
3
 * To change this license header, choose License Headers in Project Properties.
4
 * To change this template file, choose Tools | Templates
5
 * and open the template in the editor.
6
 */
7
8
namespace Test\Domain\UserAddress;
9
10
use 
0 ignored issues
show
Coding Style introduced by
There must be a single space after the USE keyword
Loading history...
11
	SimpleORM\AbstractDataMapper;
12
13
/**
14
 * Description of PriceMapper
15
 *
16
 * @author d.lanec
17
 */
18
class UserAddressMapper extends AbstractDataMapper
19
{
20
	/**
21
	 * таблица
22
	 * @var type 
23
	 */
24
	protected $table = '__test_address';
25
	
26
	/**
27
	 * создаем сущность
28
	 * 
29
	 * @param array $row
30
	 * @return type
31
	 */
32
	public function createEntity(array $row) {
33
		return $this->buildEntity(new UserAddress(), $row);
0 ignored issues
show
Bug introduced by
The call to UserAddress::__construct() misses some required arguments starting with $City.
Loading history...
34
	}	
35
	
36
	/**
37
	 * Настройка полей
38
	 */
39
	protected function setMappingFields() {
40
		
41
		//вариант 1
42
		$this
43
				->addMappingField('id', [
44
					'field'		 => 'adr_id',
45
					'primary'	 => true
46
					]
47
				)
48
				->addMappingField('code','adr_code')
49
				->addMappingField('street', 'adr_street')
50
				->addMappingField('city', [
51
					'field'		=> 'adr_cty_id',
52
					'relation'	=> 'CityMapper'
53
				])
54
			;
55
56
	}	
57
	
58
	
59
}
60