lithium\data\Source::relationFieldName()

public method

Returns the field name of a relation name (underscore).

Parameters

  • string The

    type of the relation.

  • string The

    name of the relation.

Returns

string

Source

	public function relationFieldName($type, $name) {
		$fieldName = Inflector::underscore($name);
		if (preg_match('/Many$/', $type)) {
			$fieldName = Inflector::pluralize($fieldName);
		} else {
			$fieldName = Inflector::singularize($fieldName);
		}
		return $fieldName;
	}