BEdita API doc | 4-cactus
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download

Namespaces

  • BEdita
    • API
      • Auth
      • Controller
        • Admin
        • Component
        • Model
      • Error
      • Event
      • Exception
      • Middleware
      • Model
        • Action
      • Network
        • Exception
      • Shell
      • TestSuite
      • Utility
    • Core
      • Configure
        • Engine
      • Database
        • Type
      • Exception
      • Filesystem
        • Adapter
        • Exception
        • Thumbnail
      • I18n
      • Job
        • Service
      • Mailer
        • Preview
        • Transport
      • Model
        • Action
        • Behavior
        • Entity
        • Table
        • Validation
      • ORM
        • Inheritance
        • Locator
        • Rule
      • Shell
        • Task
      • State
      • TestSuite
        • Fixture
      • Utility

Classes

  • LocationsValidator
  • MediaValidator
  • ObjectsValidator
  • ObjectTypesValidator
  • ProfilesValidator
  • SqlConventionsValidator
  • UsersValidator
  • Validation

Class SqlConventionsValidator

Validator for SQL conventions.

This validator validates a single field named symbol. Additional validation context can be passed via providers.

For instance, if you're validating an index name, you might want to pass table and type:

$validator = new SqlConventionsValidator();
$validator->setProvider('table', 'my_table_name');
$validator->setProvider('type', 'index');

$symbol = 'my_index_name';
$errors = $validator->validate(compact('symbol'));

Validating a column can be achieved in a similar way. Also, allColumns provider can be a list of columns and the table they were first found in.

$validator = new SqlConventionsValidator();
$validator->setProvider('table', 'my_table_name');
$validator->setProvider('allColumns', ['my_column' => 'table_one', 'my_other_column' => 'table_two']);

$symbol = 'my_column_name';
$errors = $validator->validate(compact('symbol'));
Cake\Validation\Validator
Extended by BEdita\Core\Model\Validation\SqlConventionsValidator
Namespace: BEdita\Core\Model\Validation
Since: 4.0.0
Located at Core/src/Model/Validation/SqlConventionsValidator.php

Methods summary

protected static array
# getReservedWords( )

Get list of reserved words.

Get list of reserved words.

Returns

array
protected static string
# getPrefix( array $context )

Get expected prefix for a symbol.

Get expected prefix for a symbol.

Parameters

$context
Context.

Returns

string
protected static string
# getSuffix( array $context )

Get expected suffix for symbol.

Get expected suffix for symbol.

Parameters

$context
Context.

Returns

string
public static boolean
# isString( mixed $symbol )

Check that a symbol is a string.

Check that a symbol is a string.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# reservedWord( string $symbol )

Check if a symbol is not a reserved word.

Check if a symbol is not a reserved word.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# underscored( string $symbol )

Check if a symbol is in underscored form.

Check if a symbol is in underscored form.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# noLeadingUnderscore( string $symbol )

Check that a symbol does not start with an underscore.

Check that a symbol does not start with an underscore.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# noTrailingUnderscore( string $symbol )

Check that a symbol does not end with an underscore.

Check that a symbol does not end with an underscore.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# noDoubleUnderscore( string $symbol )

Check that a symbol does not contain a double underscore.

Check that a symbol does not contain a double underscore.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# noLeadingDigit( string $symbol )

Check that a symbol does not start with a digit.

Check that a symbol does not start with a digit.

Parameters

$symbol
Symbol being checked.

Returns

boolean
public static boolean
# differentFromTable( string $symbol, array $context )

Chech that a symbol does not match table name.

Chech that a symbol does not match table name.

Parameters

$symbol
Symbol being checked.
$context
Context.

Returns

boolean
public static boolean|string
# prefix( string $symbol, array $context )

Check that a symbol starts with the expected prefix.

Check that a symbol starts with the expected prefix.

Parameters

$symbol
Symbol being checked.
$context
Context.

Returns

boolean|string
public static boolean|string
# suffix( string $symbol, array $context )

Check that a symbol ends with the expected suffix.

Check that a symbol ends with the expected suffix.

Parameters

$symbol
Symbol being checked.
$context
Context.

Returns

boolean|string
public static boolean
# uniqueIdentifier( string $symbol, array $context )

Check that a symbol has a custom identifier between prefix and suffix.

Check that a symbol has a custom identifier between prefix and suffix.

Parameters

$symbol
Symbol being checked.
$context
Context.

Returns

boolean
public static boolean|string
# globalName( string $symbol, array $context )

Check that a symbol hasn't been used elsewhere.

Check that a symbol hasn't been used elsewhere.

Parameters

$symbol
Symbol being checked.
$context
Context.

Returns

boolean|string
public
# __construct( )

Constants summary

string ALLOWED_RESERVED_WORDS

Comma-separated list of reserved words to be allowed anyway.

Comma-separated list of reserved words to be allowed anyway.

# 'NAME,STATUS'
string ALLOWED_DUPLICATES

Comma-separated list of columns that can be duplicated across several tables.

Comma-separated list of columns that can be duplicated across several tables.

# 'created,core_type,description,enabled,expires,id,label,modified,name,params,priority,uuid,tree_left,tree_right,lang,status,created_by,modified_by,url'

Properties summary

protected static array $reservedWords

List of reserved words.

List of reserved words.

# []
BEdita API doc | 4-cactus API documentation generated by ApiGen