Rev 59 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 59 | Rev 63 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | abstract class AbstractModel extends Base |
24 | abstract class AbstractModel extends Base |
25 | {
|
25 | {
|
26 | /**
|
26 | /**
|
27 | * Creates a new model object
|
27 | * Creates a new model object
|
28 | *
|
28 | *
|
- | 29 | * @param array $data
|
|
29 | * @param array $data Initialization data (optional)
|
30 | * Initialization data (optional)
|
- | 31 | * @param array $mapping
|
|
30 | * @param array $mapping Mapping for initialization data (optional)
|
32 | * Mapping for initialization data (optional)
|
- | 33 | * @param bool $exclusiveMapping
|
|
- | 34 | * Exclusive mapping (optional; default: inclusive)
|
|
- | 35 | * @see AbstractModel::map()
|
|
31 | */
|
36 | */
|
- | 37 | protected function __construct ( |
|
32 | protected function __construct (array $data = null, array $mapping = null) |
38 | array $data = null, array $mapping = null, $exclusiveMapping = false) |
33 | {
|
39 | {
|
34 | if (!is_null($data)) |
40 | if (!is_null($data)) |
35 | {
|
41 | {
|
36 | $this->map($data, $mapping); |
42 | $this->map($data, $mapping, $exclusiveMapping); |
37 | }
|
43 | }
|
38 | }
|
44 | }
|
39 | 45 | ||
40 | /**
|
46 | /**
|
41 | * Returns <code>true</code> if a variable name is a property variable name
|
47 | * Returns <code>true</code> if a variable name is a property variable name
|
Line 95... | Line 101... | ||
95 | * <var>$mapping</var> is <code>null</code>, the corresponding value
|
101 | * <var>$mapping</var> is <code>null</code>, the corresponding value
|
96 | * in <var>$data</var> is not mapped; if a key is missing in
|
102 | * in <var>$data</var> is not mapped; if a key is missing in
|
97 | * <var>$mapping</var>, the value is mapped as if <var>$mapping</var>
|
103 | * <var>$mapping</var>, the value is mapped as if <var>$mapping</var>
|
98 | * was <code>null</code>.</p>
|
104 | * was <code>null</code>.</p>
|
99 | * @param bool $exclusive = false
|
105 | * @param bool $exclusive = false
|
100 | * <p>If <code>true</code>, <em>only</em> the keys of $data that are present
|
106 | * <p>If <code>true</code>, <em>only</em> the keys of <var>$data</var>
|
101 | * in $mapping are mapped.</p>
|
107 | * that are present in <var>$mapping</var> are mapped.</p>
|
102 | * @return AbstractModel
|
108 | * @return AbstractModel
|
103 | * The modified object
|
109 | * The modified object
|
104 | */
|
110 | */
|
105 | public function map (array $data, array $mapping = null, $exclusive = false) |
111 | public function map (array $data, array $mapping = null, $exclusive = false) |
106 | {
|
112 | {
|