LudoJS service class.

This class outputs LudoJS config objects for LudoDB instances

Example where LudoJS config for LudoDBModel Person is returned with values of Person with id equals 1:

$handler = new LudoDBRequestHandler();
echo $handler->handle('LudoJS/Person/1/form');

This will return the config as a JSON string.

package LudoDB
author Alf Magne Kalleland

 Methods

Construct new instance

__construct() 

"form" service

form() : array

Returns

array

Returns empty string as on success message for service

getOnSuccessMessageFor(String $service) : String

Parameters

$service

String

Returns

String

Return "form" as only valid service

getValidServices() : array

Returns

array

No caching

shouldCache(string $service) : bool

When true a serialized version of LudoDBModel::read will be stored in a caching table. When caching is enabled, you should also implement clearCache() to clear cache in case Data has been changed.

Parameters

$service

string

Returns

bool

Accepted number of arguments is 1 or 2 (second argument is optional "id" of resource)

validateArguments(String $service, Array $arguments) : bool

Parameters

$service

String

$arguments

Array

Returns

bool

No data is allowed to this service

validateServiceData(string $service, array $data) : bool

Parameters

$service

string

$data

array

Returns

bool

Add validation properties to LudoJS column

addValidation($children) : mixed

Parameters

$children

Returns

mixed

Create dataSource objects for children.

createDataSources($children) : mixed

Parameters

$children

Returns

mixed

Return childrne in correct order according to "order" attribute

getChildrenInRightOrder(array $children) : array

Parameters

$children

array

Returns

array

Return data source config with values for columns.

getDataSourceConfig($source) : array

Parameters

$source

Returns

array

Return model resource to handle

getModelResource() : \LudoDBObject

Use Reflection to get instance of resource class

getReflectionClass($className) : \ReflectionClass

Parameters

$className

Exceptions

\LudoDBClassNotFoundException

Returns

Returns true if given string matches pattern for a regex flag/modifiers

isRegexFlag($token) : int

Parameters

$token

Returns

int

Add "value" properties to children.

setChildValues($children) : mixed

Parameters

$children

Returns

mixed

Update child array with default properties when not specified in config, example "label"

setMissingProperties($children) : mixed

Parameters

$children

Returns

mixed

 Properties

 

$resource : \LudoDBObject