Code Duplication    Length = 15-17 lines in 2 locations

src/AbstractActiveRecord.php 2 locations

@@ 104-118 (lines=15) @@
101
	/**
102
	 * {@inheritdoc}
103
	 */
104
	public function update()
105
	{
106
		if (!$this->exists()) {
107
			throw new ActiveRecordException('Can\'t update a non-existent record.');
108
		}
109
110
		try {
111
			$pdoStatement = $this->getPdo()->prepare($this->getUpdateQuery());
112
			$pdoStatement->execute(['id' => $this->getId()] + $this->getActiveRecordData());
113
		} catch (\PDOException $e) {
114
			throw new ActiveRecordException('Can\'t update the record.', 0, $e);
115
		}
116
117
		return $this;
118
	}
119
120
	/**
121
	 * Returns the update query.
@@ 139-155 (lines=17) @@
136
	/**
137
	 * {@inheritdoc}
138
	 */
139
	public function delete()
140
	{
141
		if (!$this->exists()) {
142
			throw new ActiveRecordException('Can\'t delete a non-existent record.');
143
		}
144
145
		try {
146
			$pdoStatement = $this->getPdo()->prepare($this->getDeleteQuery());
147
			$pdoStatement->execute(['id' => $this->getId()]);
148
149
			$this->setId(null);
150
		} catch (\PDOException $e) {
151
			throw new ActiveRecordException('Can\'t delete the record.', 0, $e);
152
		}
153
154
		return $this;
155
	}
156
157
	/**
158
	 * Returns the delete query.