Rev 35 | Rev 51 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 35 | Rev 49 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | * Creates a new model object
|
26 | * Creates a new model object
|
27 | *
|
27 | *
|
28 | * @param array $data Initialization data (optional)
|
28 | * @param array $data Initialization data (optional)
|
29 | * @param array $mapping Mapping for initialization data (optional)
|
29 | * @param array $mapping Mapping for initialization data (optional)
|
30 | */
|
30 | */
|
31 | public function __construct(array $data = null, array $mapping = null) |
31 | protected function __construct(array $data = null, array $mapping = null) |
32 | {
|
32 | {
|
33 | if (!is_null($data)) |
33 | if (!is_null($data)) |
34 | {
|
34 | {
|
35 | $this->map($data, $mapping); |
35 | $this->map($data, $mapping); |
36 | }
|
36 | }
|
Line 152... | Line 152... | ||
152 | * <var>$mapping</var>, the value is mapped as if <var>$mapping</var>
|
152 | * <var>$mapping</var>, the value is mapped as if <var>$mapping</var>
|
153 | * was <code>null</code>.</p>
|
153 | * was <code>null</code>.</p>
|
154 | * @param bool $exclusive = false
|
154 | * @param bool $exclusive = false
|
155 | * <p>If <code>true</code>, <em>only</em> the keys of $data that are present
|
155 | * <p>If <code>true</code>, <em>only</em> the keys of $data that are present
|
156 | * in $mapping are mapped.</p>
|
156 | * in $mapping are mapped.</p>
|
- | 157 | * @return AbstractModel
|
|
- | 158 | * The modified object
|
|
157 | */
|
159 | */
|
158 | public function map(array $data, array $mapping = null, $exclusive = false) |
160 | public function map(array $data, array $mapping = null, $exclusive = false) |
159 | {
|
161 | {
|
160 | if (is_null($mapping)) |
162 | if (is_null($mapping)) |
161 | {
|
163 | {
|
Line 179... | Line 181... | ||
179 | {
|
181 | {
|
180 | $this->$key = $value; |
182 | $this->$key = $value; |
181 | }
|
183 | }
|
182 | }
|
184 | }
|
183 | }
|
185 | }
|
- | 186 | ||
- | 187 | return $this; |
|
184 | }
|
188 | }
|
185 | }
|
189 | }
|
186 | 190 |