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