lithium\data\source\Database::_splitFieldname()

protected method

Return the alias and the field name from an identifier name.

Parameters

  • string $field

    Field name or identifier name.

Returns

array

Returns an array with the alias (or null if not applicable) as first value and the field name as second value.

Source

	protected function _splitFieldname($field) {
		$regex = '/^([a-z0-9_-]+)\.([a-z 0-9_-]+|\*)$/iS';

		if (strpos($field, '.') !== false && preg_match($regex, $field, $matches)) {
			return [$matches[1], $matches[2]];
		}
		return [null, $field];
	}