public function equals($record) { if ($this->getIsNewRecord() || $record->getIsNewRecord()) { return false; } return get_class($this) === get_class($record) && $this->getPrimaryKey() === $record->getPrimaryKey(); }