Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Validate_RecordField Class Reference

Validates string for suitability as a record field name. More...

Inheritance diagram for P4Cms_Validate_RecordField:
P4_Validate_AttributeName P4_Validate_KeyName P4_Validate_Abstract P4Cms_Validate_ContentTypeElementName

List of all members.

Public Member Functions

 __construct ()
 Add a message template upon instantiation.
 isValid ($value)
 Checks if the given string is a valid record field name.

Public Attributes

const LEADING_UNDERSCORE = 'leadingUnderscore'

Detailed Description

Validates string for suitability as a record field name.

The string must pass p4 attribute name validation. Additionally, it cannot begin with an underscore as this is reserved for record field metadata.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Constructor & Destructor Documentation

P4Cms_Validate_RecordField::__construct ( )

Add a message template upon instantiation.

Reimplemented in P4Cms_Validate_ContentTypeElementName.

    {
        $message = "First character cannot be underscore ('_').";
        $this->_messageTemplates[self::LEADING_UNDERSCORE] = $message;
    }

Member Function Documentation

P4Cms_Validate_RecordField::isValid ( value)

Checks if the given string is a valid record field name.

Parameters:
string$valuethe value to validate.
Returns:
boolean true if value is a valid field name, false otherwise.

Reimplemented from P4_Validate_KeyName.

Reimplemented in P4Cms_Validate_ContentTypeElementName.

    {
        // test for leading underscore ('_') character.
        if ($value[0] === "_") {
            $this->_error(static::LEADING_UNDERSCORE);
            return false;
        }

        return parent::isValid($value);
    }

Member Data Documentation


The documentation for this class was generated from the following file: