lithium\data\Model::instanceMethods()

public static method

Getter and setter for custom instance methods. This is used in __call().

Model::instanceMethods([
    'methodName' => ['Class', 'method'],
    'anotherMethod' => [$object, 'method'],
    'closureCallback' => function($entity) {}
]);

Parameters

  • array $methods

Returns

array

Source

	public static function instanceMethods(array $methods = null) {
		$class = get_called_class();

		if (!isset(static::$_instanceMethods[$class])) {
			static::$_instanceMethods[$class] = [];
		}
		if ($methods === []) {
			return static::$_instanceMethods[$class] = [];
		}
		if ($methods !== null) {
			static::$_instanceMethods[$class] = $methods + static::$_instanceMethods[$class];
		}
		return static::$_instanceMethods[$class];
	}