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