yii\db\BaseActiveRecord::equals PHP Method

equals() public method

The comparison is made by comparing the table names and the primary key values of the two active records. If one of the records [[isNewRecord|is new]] they are also considered not equal.
public equals ( yii\db\ActiveRecordInterface $record ) : boolean
$record yii\db\ActiveRecordInterface record to compare to
return boolean whether the two active records refer to the same row in the same database table.
    public function equals($record)
    {
        if ($this->getIsNewRecord() || $record->getIsNewRecord()) {
            return false;
        }
        return get_class($this) === get_class($record) && $this->getPrimaryKey() === $record->getPrimaryKey();
    }