Previous Page
locale()

Solar_Sql_Model_Filter_ValidateUnique
validateUnique()

Next Class
Solar_Sql_Model_Record

validateUnique()

public bool validateUnique ( mixed $value, mixed $where default NULL )

Validates that a value for the current data key is unique among all model records of its inheritance type.

Parameters

  • (mixed) $value: The value to validate.
  • (mixed) $where: Additional "WHERE" conditions to exclude records from the uniqueness check.

Returns

  • (bool) True if unique, false if not.

Description

Validates that a value for the current data key is unique among all model records of its inheritance type.

This will exclude any record having the same primary-key value as the current record.

<?php
$where = array(
    'id != :id', // or 'id IS NOT NULL' if the ID is null
);
?>