Completed
Push — master ( 281aaa...7f49f2 )
by Michael
03:22
created
src/ActiveRecordInterface.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -19,83 +19,83 @@
 block discarded – undo
19 19
  */
20 20
 interface ActiveRecordInterface
21 21
 {
22
-	/**
23
-	 * Returns this active record after creating an entry with the records attributes.
24
-	 *
25
-	 * @return $this
26
-	 * @throws ActiveRecordException on failure.
27
-	 */
28
-	public function create();
22
+    /**
23
+     * Returns this active record after creating an entry with the records attributes.
24
+     *
25
+     * @return $this
26
+     * @throws ActiveRecordException on failure.
27
+     */
28
+    public function create();
29 29
 
30
-	/**
31
-	 * Returns this active record after reading the attributes from the entry with the given identifier.
32
-	 *
33
-	 * @param mixed $id
34
-	 * @return $this
35
-	 * @throws ActiveRecordException on failure.
36
-	 */
37
-	public function read($id);
30
+    /**
31
+     * Returns this active record after reading the attributes from the entry with the given identifier.
32
+     *
33
+     * @param mixed $id
34
+     * @return $this
35
+     * @throws ActiveRecordException on failure.
36
+     */
37
+    public function read($id);
38 38
 
39
-	/**
40
-	 * Returns this active record after updating the attributes to the corresponding entry.
41
-	 *
42
-	 * @return $this
43
-	 * @throws ActiveRecordException on failure.
44
-	 */
45
-	public function update();
39
+    /**
40
+     * Returns this active record after updating the attributes to the corresponding entry.
41
+     *
42
+     * @return $this
43
+     * @throws ActiveRecordException on failure.
44
+     */
45
+    public function update();
46 46
 
47
-	/**
48
-	 * Returns this record after deleting the corresponding entry.
49
-	 *
50
-	 * @return $this
51
-	 * @throws ActiveRecordException on failure.
52
-	 */
53
-	public function delete();
47
+    /**
48
+     * Returns this record after deleting the corresponding entry.
49
+     *
50
+     * @return $this
51
+     * @throws ActiveRecordException on failure.
52
+     */
53
+    public function delete();
54 54
 
55
-	/**
56
-	 * Returns this record after synchronizing it with the corresponding entry.
57
-	 * A new entry is created if this active record does not have a corresponding entry.
58
-	 *
59
-	 * @return $this
60
-	 * @throws ActiveRecordException on failure.
61
-	 */
62
-	public function sync();
55
+    /**
56
+     * Returns this record after synchronizing it with the corresponding entry.
57
+     * A new entry is created if this active record does not have a corresponding entry.
58
+     *
59
+     * @return $this
60
+     * @throws ActiveRecordException on failure.
61
+     */
62
+    public function sync();
63 63
 
64
-	/**
65
-	 * Returns true if this active record has a corresponding entry.
66
-	 *
67
-	 * @return bool true if this active record has a corresponding entry.
68
-	 */
69
-	public function exists();
64
+    /**
65
+     * Returns true if this active record has a corresponding entry.
66
+     *
67
+     * @return bool true if this active record has a corresponding entry.
68
+     */
69
+    public function exists();
70 70
 
71
-	/**
72
-	 * Returns this record after filling it with the given attributes.
73
-	 *
74
-	 * @param array $attributes = []
75
-	 * @return $this
76
-	 * @throws ActiveRecordException on failure.
77
-	 */
78
-	public function fill(array $attributes);
71
+    /**
72
+     * Returns this record after filling it with the given attributes.
73
+     *
74
+     * @param array $attributes = []
75
+     * @return $this
76
+     * @throws ActiveRecordException on failure.
77
+     */
78
+    public function fill(array $attributes);
79 79
 
80
-	/**
81
-	 * Returns this record after filling it with the attributes of the first entry with the given where and order by clauses.
82
-	 *
83
-	 * @param array $where = []
84
-	 * @param array $orderBy = []
85
-	 * @return $this
86
-	 * @throws ActiveRecordException on failure.
87
-	 */
88
-	public function searchOne(array $where = [], array $orderBy = []);
80
+    /**
81
+     * Returns this record after filling it with the attributes of the first entry with the given where and order by clauses.
82
+     *
83
+     * @param array $where = []
84
+     * @param array $orderBy = []
85
+     * @return $this
86
+     * @throws ActiveRecordException on failure.
87
+     */
88
+    public function searchOne(array $where = [], array $orderBy = []);
89 89
 
90
-	/**
91
-	 * Returns the records with the given where, order by, limit and offset clauses.
92
-	 *
93
-	 * @param array $where = []
94
-	 * @param array $orderBy = []
95
-	 * @param int $limit = -1
96
-	 * @param int $offset = 0
97
-	 * @return static[] the records with the given where, order by, limit and offset clauses.
98
-	 * @throws ActiveRecordException on failure.
99
-	 */
100
-	public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0);
90
+    /**
91
+     * Returns the records with the given where, order by, limit and offset clauses.
92
+     *
93
+     * @param array $where = []
94
+     * @param array $orderBy = []
95
+     * @param int $limit = -1
96
+     * @param int $offset = 0
97
+     * @return static[] the records with the given where, order by, limit and offset clauses.
98
+     * @throws ActiveRecordException on failure.
99
+     */
100
+    public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0);
101 101
 }
Please login to merge, or discard this patch.
src/AbstractActiveRecord.php 1 patch
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -19,324 +19,324 @@
 block discarded – undo
19 19
  */
20 20
 abstract class AbstractActiveRecord implements ActiveRecordInterface
21 21
 {
22
-	/** @var \PDO The PDO object. */
23
-	private $pdo;
24
-
25
-	/** @var null|int The ID. */
26
-	private $id;
27
-
28
-	/**
29
-	 * Construct an abstract pdo active record with the given pdo.
30
-	 *
31
-	 * @param \PDO $pdo
32
-	 */
33
-	public function __construct(\PDO $pdo)
34
-	{
35
-		$pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
36
-		$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
37
-
38
-		$this->setPdo($pdo);
39
-	}
40
-
41
-	/**
42
-	 * {@inheritdoc}
43
-	 */
44
-	public function create()
45
-	{
46
-		try {
47
-			(new Query($this->getPdo(), $this->getActiveRecordTable()))
48
-				->insert($this->getActiveRecordColumns())
49
-				->execute();
50
-
51
-			$this->setId(intval($this->getPdo()->lastInsertId()));
52
-		} catch (\PDOException $e) {
53
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
54
-		}
55
-
56
-		return $this;
57
-	}
58
-
59
-	/**
60
-	 * {@inheritdoc}
61
-	 */
62
-	public function read($id)
63
-	{
64
-		try {
65
-			$result = (new Query($this->getPdo(), $this->getActiveRecordTable()))
66
-				->select()
67
-				->where('id', '=', $id)
68
-				->execute()
69
-				->fetch();
70
-
71
-			if ($result === false) {
72
-				throw new ActiveRecordException(sprintf('Can not read the non-existent active record entry %d from the `%s` table.', $id, $this->getActiveRecordTable()));
73
-			}
74
-
75
-			$this->fill($result);
76
-			$this->setId($id);
77
-		} catch (\PDOException $e) {
78
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
79
-		}
80
-
81
-		return $this;
82
-	}
83
-
84
-	/**
85
-	 * {@inheritdoc}
86
-	 */
87
-	public function update()
88
-	{
89
-		if (!$this->exists()) {
90
-			throw new ActiveRecordException(sprintf('Can not update a non-existent active record entry to the `%s` table.', $this->getActiveRecordTable()));
91
-		}
92
-
93
-		try {
94
-			(new Query($this->getPdo(), $this->getActiveRecordTable()))
95
-				->update($this->getActiveRecordColumns())
96
-				->where('id', '=', $this->getId())
97
-				->execute();
98
-		} catch (\PDOException $e) {
99
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
100
-		}
101
-
102
-		return $this;
103
-	}
104
-
105
-	/**
106
-	 * {@inheritdoc}
107
-	 */
108
-	public function delete()
109
-	{
110
-		if (!$this->exists()) {
111
-			throw new ActiveRecordException(sprintf('Can not delete a non-existent active record entry from the `%s` table.', $this->getActiveRecordTable()));
112
-		}
113
-
114
-		try {
115
-			(new Query($this->getPdo(), $this->getActiveRecordTable()))
116
-				->delete()
117
-				->where('id', '=', $this->getId())
118
-				->execute();
119
-
120
-			$this->setId(null);
121
-		} catch (\PDOException $e) {
122
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
123
-		}
124
-
125
-		return $this;
126
-	}
127
-
128
-	/**
129
-	 * {@inheritdoc}
130
-	 */
131
-	public function sync()
132
-	{
133
-		if (!$this->exists()) {
134
-			return $this->create();
135
-		}
136
-
137
-		return $this->update();
138
-	}
139
-
140
-	/**
141
-	 * {@inheritdoc}
142
-	 */
143
-	public function exists()
144
-	{
145
-		return $this->getId() !== null;
146
-	}
147
-
148
-	/**
149
-	 * Fill the active record
150
-	 *
151
-	 * @param array $fetch
152
-	 * @return null
153
-	 */
154
-	public function fill(array $fetch)
155
-	{
156
-		$data = $this->getActiveRecordColumns();
157
-
158
-		foreach ($data as $key => &$value) {
159
-			if (!array_key_exists($key, $fetch)) {
160
-				throw new ActiveRecordException(sprintf('Can not read the expected column `%s`. It\'s not returnd by the `%s` table', $key, $this->getActiveRecordTable()));
161
-			}
162
-
163
-			$value = $fetch[$key];
164
-		}
165
-	}
166
-
167
-	/**
168
-	 * {@inheritdoc}
169
-	 */
170
-	public function searchOne(array $where = [], array $orderBy = [])
171
-	{
172
-		try {
173
-			$result = $this->getSearchQueryResult($where, $orderBy, 1)->fetch();
174
-
175
-			if ($result === false) {
176
-				throw new ActiveRecordException(sprintf('Can not search one non-existent entry from the `%s` table.', $this->getActiveRecordTable()));
177
-			}
178
-
179
-			$this->fill($result);
180
-			$this->setId(intval($result['id']));
181
-
182
-			return $this;
183
-		} catch (\PDOException $e) {
184
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
185
-		}
186
-	}
187
-
188
-	/**
189
-	 * {@inheritdoc}
190
-	 */
191
-	public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
192
-	{
193
-		try {
194
-			$queryResult = $this->getSearchQueryResult($where, $orderBy, $limit, $offset);
195
-			$result = [];
196
-
197
-			foreach ($queryResult as $fetch) {
198
-				$new = new static($this->getPdo());
199
-
200
-				$new->setId(intval($fetch['id']));
201
-				$new->fill($fetch);
202
-
203
-				$result[] = $new;
204
-			}
205
-
206
-			return $result;
207
-		} catch (\PDOException $e) {
208
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
209
-		}
210
-	}
211
-
212
-	/**
213
-	 * Returns the search query result with the given where, order by, limit and offset clauses.
214
-	 *
215
-	 * @param array $where = []
216
-	 * @param array $orderBy = []
217
-	 * @param int $limit = -1
218
-	 * @param int $offset = 0
219
-	 * @return \miBadger\Query\QueryResult the search query result with the given where, order by, limit and offset clauses.
220
-	 */
221
-	private function getSearchQueryResult(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
222
-	{
223
-		$query = (new Query($this->getPdo(), $this->getActiveRecordTable()))
224
-			->select();
225
-
226
-		$this->getSearchQueryWhere($query, $where);
227
-		$this->getSearchQueryOrderBy($query, $orderBy);
228
-		$this->getSearchQueryLimit($query, $limit, $offset);
229
-
230
-		return $query->execute();
231
-	}
232
-
233
-	/**
234
-	 * Returns the given query after adding the given where conditions.
235
-	 *
236
-	 * @param \miBadger\Query\Query $query
237
-	 * @param array $where
238
-	 * @return \miBadger\Query\Query the given query after adding the given where conditions.
239
-	 */
240
-	private function getSearchQueryWhere($query, $where)
241
-	{
242
-		foreach ($where as $key => $value) {
243
-			$query->where($value[0], $value[1], $value[2]);
244
-		}
245
-
246
-		return $query;
247
-	}
248
-
249
-	/**
250
-	 * Returns the given query after adding the given order by conditions.
251
-	 *
252
-	 * @param \miBadger\Query\Query $query
253
-	 * @param array $orderBy
254
-	 * @return \miBadger\Query\Query the given query after adding the given order by conditions.
255
-	 */
256
-	private function getSearchQueryOrderBy($query, $orderBy)
257
-	{
258
-		foreach ($orderBy as $key => $value) {
259
-			$query->orderBy($key, $value);
260
-		}
261
-
262
-		return $query;
263
-	}
264
-
265
-	/**
266
-	 * Returns the given query after adding the given limit and offset conditions.
267
-	 *
268
-	 * @param \miBadger\Query\Query $query
269
-	 * @param int $limit
270
-	 * @param int $offset
271
-	 * @return \miBadger\Query\Query the given query after adding the given limit and offset conditions.
272
-	 */
273
-	private function getSearchQueryLimit($query, $limit, $offset)
274
-	{
275
-		if ($limit > -1) {
276
-			$query->limit($limit);
277
-			$query->offset($offset);
278
-		}
279
-
280
-		return $query;
281
-	}
282
-
283
-	/**
284
-	 * Returns the PDO.
285
-	 *
286
-	 * @return \PDO the PDO.
287
-	 */
288
-	public function getPdo()
289
-	{
290
-		return $this->pdo;
291
-	}
292
-
293
-	/**
294
-	 * Set the PDO.
295
-	 *
296
-	 * @param \PDO $pdo
297
-	 * @return $this
298
-	 */
299
-	protected function setPdo($pdo)
300
-	{
301
-		$this->pdo = $pdo;
302
-
303
-		return $this;
304
-	}
305
-
306
-	/**
307
-	 * Returns the ID.
308
-	 *
309
-	 * @return null|int The ID.
310
-	 */
311
-	public function getId()
312
-	{
313
-		return $this->id;
314
-	}
315
-
316
-	/**
317
-	 * Set the ID.
318
-	 *
319
-	 * @param int $id
320
-	 * @return $this
321
-	 */
322
-	protected function setId($id)
323
-	{
324
-		$this->id = $id;
325
-
326
-		return $this;
327
-	}
328
-
329
-	/**
330
-	 * Returns the active record table.
331
-	 *
332
-	 * @return string the active record table.
333
-	 */
334
-	abstract protected function getActiveRecordTable();
335
-
336
-	/**
337
-	 * Returns the active record columns.
338
-	 *
339
-	 * @return array the active record columns.
340
-	 */
341
-	abstract protected function getActiveRecordColumns();
22
+    /** @var \PDO The PDO object. */
23
+    private $pdo;
24
+
25
+    /** @var null|int The ID. */
26
+    private $id;
27
+
28
+    /**
29
+     * Construct an abstract pdo active record with the given pdo.
30
+     *
31
+     * @param \PDO $pdo
32
+     */
33
+    public function __construct(\PDO $pdo)
34
+    {
35
+        $pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
36
+        $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
37
+
38
+        $this->setPdo($pdo);
39
+    }
40
+
41
+    /**
42
+     * {@inheritdoc}
43
+     */
44
+    public function create()
45
+    {
46
+        try {
47
+            (new Query($this->getPdo(), $this->getActiveRecordTable()))
48
+                ->insert($this->getActiveRecordColumns())
49
+                ->execute();
50
+
51
+            $this->setId(intval($this->getPdo()->lastInsertId()));
52
+        } catch (\PDOException $e) {
53
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
54
+        }
55
+
56
+        return $this;
57
+    }
58
+
59
+    /**
60
+     * {@inheritdoc}
61
+     */
62
+    public function read($id)
63
+    {
64
+        try {
65
+            $result = (new Query($this->getPdo(), $this->getActiveRecordTable()))
66
+                ->select()
67
+                ->where('id', '=', $id)
68
+                ->execute()
69
+                ->fetch();
70
+
71
+            if ($result === false) {
72
+                throw new ActiveRecordException(sprintf('Can not read the non-existent active record entry %d from the `%s` table.', $id, $this->getActiveRecordTable()));
73
+            }
74
+
75
+            $this->fill($result);
76
+            $this->setId($id);
77
+        } catch (\PDOException $e) {
78
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
79
+        }
80
+
81
+        return $this;
82
+    }
83
+
84
+    /**
85
+     * {@inheritdoc}
86
+     */
87
+    public function update()
88
+    {
89
+        if (!$this->exists()) {
90
+            throw new ActiveRecordException(sprintf('Can not update a non-existent active record entry to the `%s` table.', $this->getActiveRecordTable()));
91
+        }
92
+
93
+        try {
94
+            (new Query($this->getPdo(), $this->getActiveRecordTable()))
95
+                ->update($this->getActiveRecordColumns())
96
+                ->where('id', '=', $this->getId())
97
+                ->execute();
98
+        } catch (\PDOException $e) {
99
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
100
+        }
101
+
102
+        return $this;
103
+    }
104
+
105
+    /**
106
+     * {@inheritdoc}
107
+     */
108
+    public function delete()
109
+    {
110
+        if (!$this->exists()) {
111
+            throw new ActiveRecordException(sprintf('Can not delete a non-existent active record entry from the `%s` table.', $this->getActiveRecordTable()));
112
+        }
113
+
114
+        try {
115
+            (new Query($this->getPdo(), $this->getActiveRecordTable()))
116
+                ->delete()
117
+                ->where('id', '=', $this->getId())
118
+                ->execute();
119
+
120
+            $this->setId(null);
121
+        } catch (\PDOException $e) {
122
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
123
+        }
124
+
125
+        return $this;
126
+    }
127
+
128
+    /**
129
+     * {@inheritdoc}
130
+     */
131
+    public function sync()
132
+    {
133
+        if (!$this->exists()) {
134
+            return $this->create();
135
+        }
136
+
137
+        return $this->update();
138
+    }
139
+
140
+    /**
141
+     * {@inheritdoc}
142
+     */
143
+    public function exists()
144
+    {
145
+        return $this->getId() !== null;
146
+    }
147
+
148
+    /**
149
+     * Fill the active record
150
+     *
151
+     * @param array $fetch
152
+     * @return null
153
+     */
154
+    public function fill(array $fetch)
155
+    {
156
+        $data = $this->getActiveRecordColumns();
157
+
158
+        foreach ($data as $key => &$value) {
159
+            if (!array_key_exists($key, $fetch)) {
160
+                throw new ActiveRecordException(sprintf('Can not read the expected column `%s`. It\'s not returnd by the `%s` table', $key, $this->getActiveRecordTable()));
161
+            }
162
+
163
+            $value = $fetch[$key];
164
+        }
165
+    }
166
+
167
+    /**
168
+     * {@inheritdoc}
169
+     */
170
+    public function searchOne(array $where = [], array $orderBy = [])
171
+    {
172
+        try {
173
+            $result = $this->getSearchQueryResult($where, $orderBy, 1)->fetch();
174
+
175
+            if ($result === false) {
176
+                throw new ActiveRecordException(sprintf('Can not search one non-existent entry from the `%s` table.', $this->getActiveRecordTable()));
177
+            }
178
+
179
+            $this->fill($result);
180
+            $this->setId(intval($result['id']));
181
+
182
+            return $this;
183
+        } catch (\PDOException $e) {
184
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
185
+        }
186
+    }
187
+
188
+    /**
189
+     * {@inheritdoc}
190
+     */
191
+    public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
192
+    {
193
+        try {
194
+            $queryResult = $this->getSearchQueryResult($where, $orderBy, $limit, $offset);
195
+            $result = [];
196
+
197
+            foreach ($queryResult as $fetch) {
198
+                $new = new static($this->getPdo());
199
+
200
+                $new->setId(intval($fetch['id']));
201
+                $new->fill($fetch);
202
+
203
+                $result[] = $new;
204
+            }
205
+
206
+            return $result;
207
+        } catch (\PDOException $e) {
208
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
209
+        }
210
+    }
211
+
212
+    /**
213
+     * Returns the search query result with the given where, order by, limit and offset clauses.
214
+     *
215
+     * @param array $where = []
216
+     * @param array $orderBy = []
217
+     * @param int $limit = -1
218
+     * @param int $offset = 0
219
+     * @return \miBadger\Query\QueryResult the search query result with the given where, order by, limit and offset clauses.
220
+     */
221
+    private function getSearchQueryResult(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
222
+    {
223
+        $query = (new Query($this->getPdo(), $this->getActiveRecordTable()))
224
+            ->select();
225
+
226
+        $this->getSearchQueryWhere($query, $where);
227
+        $this->getSearchQueryOrderBy($query, $orderBy);
228
+        $this->getSearchQueryLimit($query, $limit, $offset);
229
+
230
+        return $query->execute();
231
+    }
232
+
233
+    /**
234
+     * Returns the given query after adding the given where conditions.
235
+     *
236
+     * @param \miBadger\Query\Query $query
237
+     * @param array $where
238
+     * @return \miBadger\Query\Query the given query after adding the given where conditions.
239
+     */
240
+    private function getSearchQueryWhere($query, $where)
241
+    {
242
+        foreach ($where as $key => $value) {
243
+            $query->where($value[0], $value[1], $value[2]);
244
+        }
245
+
246
+        return $query;
247
+    }
248
+
249
+    /**
250
+     * Returns the given query after adding the given order by conditions.
251
+     *
252
+     * @param \miBadger\Query\Query $query
253
+     * @param array $orderBy
254
+     * @return \miBadger\Query\Query the given query after adding the given order by conditions.
255
+     */
256
+    private function getSearchQueryOrderBy($query, $orderBy)
257
+    {
258
+        foreach ($orderBy as $key => $value) {
259
+            $query->orderBy($key, $value);
260
+        }
261
+
262
+        return $query;
263
+    }
264
+
265
+    /**
266
+     * Returns the given query after adding the given limit and offset conditions.
267
+     *
268
+     * @param \miBadger\Query\Query $query
269
+     * @param int $limit
270
+     * @param int $offset
271
+     * @return \miBadger\Query\Query the given query after adding the given limit and offset conditions.
272
+     */
273
+    private function getSearchQueryLimit($query, $limit, $offset)
274
+    {
275
+        if ($limit > -1) {
276
+            $query->limit($limit);
277
+            $query->offset($offset);
278
+        }
279
+
280
+        return $query;
281
+    }
282
+
283
+    /**
284
+     * Returns the PDO.
285
+     *
286
+     * @return \PDO the PDO.
287
+     */
288
+    public function getPdo()
289
+    {
290
+        return $this->pdo;
291
+    }
292
+
293
+    /**
294
+     * Set the PDO.
295
+     *
296
+     * @param \PDO $pdo
297
+     * @return $this
298
+     */
299
+    protected function setPdo($pdo)
300
+    {
301
+        $this->pdo = $pdo;
302
+
303
+        return $this;
304
+    }
305
+
306
+    /**
307
+     * Returns the ID.
308
+     *
309
+     * @return null|int The ID.
310
+     */
311
+    public function getId()
312
+    {
313
+        return $this->id;
314
+    }
315
+
316
+    /**
317
+     * Set the ID.
318
+     *
319
+     * @param int $id
320
+     * @return $this
321
+     */
322
+    protected function setId($id)
323
+    {
324
+        $this->id = $id;
325
+
326
+        return $this;
327
+    }
328
+
329
+    /**
330
+     * Returns the active record table.
331
+     *
332
+     * @return string the active record table.
333
+     */
334
+    abstract protected function getActiveRecordTable();
335
+
336
+    /**
337
+     * Returns the active record columns.
338
+     *
339
+     * @return array the active record columns.
340
+     */
341
+    abstract protected function getActiveRecordColumns();
342 342
 }
Please login to merge, or discard this patch.