public static function compare($modelType, $propertyName, $compareWith, $errorMessage = null) {
        if (!self::canAnnotate($modelType)) {
            return;
        }

        if (empty($propertyName)) {
            throw new \Exception('$propertyName must not be empty.');
        }

        if (empty($compareWith)) {
            throw new \Exception('$compareWith must not be empty.');
        }

        if ($propertyName === $compareWith) {
            throw new \Exception('The property names must be different.');
        }

        self::makeDataAnnotation($propertyName);

        self::$annotations[$propertyName]->compareWith = array($compareWith, $errorMessage);
    }
public static function compare($modelType, $propertyName, $compareWith, $errorMessage = null) {
        if (!self::canAnnotate($modelType)) {
            return;
        }

        if (empty($propertyName)) {
            throw new \Exception('$propertyName must not be empty.');
        }

        if (empty($compareWith)) {
            throw new \Exception('$compareWith must not be empty.');
        }

        if ($propertyName === $compareWith) {
            throw new \Exception('The property names must be different.');
        }

        self::makeDataAnnotation($propertyName);

        self::$annotations[$propertyName]->compareWith = array($compareWith, $errorMessage);
    }
public static function compare ( $ modelType , $ propertyName , $ compareWith , $ errorMessage = null ) { if ( ! self :: canAnnotate ( $ modelType ) ) { return ; } if ( empty ( $ propertyName ) ) { throw new \ Exception ( '$propertyName must not be empty.' ) ; } if ( empty ( $ compareWith ) ) { throw new \ Exception ( '$compareWith must not be empty.' ) ; } if ( $ propertyName === $ compareWith ) { throw new \ Exception ( 'The property names must be different.' ) ; } self :: makeDataAnnotation ( $ propertyName ) ; self :: $ annotations [ $ propertyName ] -> compareWith = array ( $ compareWith , $ errorMessage ) ; }
Sets a property whose value needs to be compared to the value of the specified property.

@param string|object $modelType The name type of model.
@param string $propertyName The property name.
@param string $compareWith The name of the property with which to compare.
@param string $errorMessage The error message.

@return void
Sets a property whose value needs to be compared to the value of the specified property .