ObjectServiceField Class
A custom field is used by the ObjectService class to represent property and db field definitions
Constructor
Item Index
Methods
Methods
__toString
()
String
Represent the query as a SQL statement
Returns:
The query in SQL string form
fieldToProperty
-
id
Convert a mysql field (eg. content_id) to property (e.g. contentId)
Parameters:
-
id
StringThe input field name (lowercase, comma separated)
Returns:
The property name (lower, camel-cased)
option
-
property
-
value
Set an option
Parameters:
-
property
StringEither type, name, isIndex, select, prepend
-
value
MixedThe value of the property to set
Returns:
Return the field for chaining
setDefault
-
[isDefault=true]
Set the default index, e.g., instead of calling getItemById, you can do getItem
Parameters:
-
[isDefault=true]
Boolean optionalIf the field is the default index
Returns:
Return the field for chaining
setIndex
-
[isIndex=true]
Set the field to be an index, a method can be called, getItemsByName, where name is the indexed field. Database should also consider this an index.
Parameters:
-
[isIndex=true]
Boolean optionalIf the field is index
Returns:
Return the field for chaining
setOrderBy
-
[orderBy='asc']
If we should sort collection selects by this property.
Parameters:
-
[orderBy='asc']
String optionalThe string to prepend to result value
Returns:
Return the field for chaining
setPrepend
-
prepend
Prepend this item with a string, useful for prepending full file path to a file name stored in the database.
Parameters:
-
prepend
StringThe string to prepend to result value
Returns:
Return the field for chaining
setSelect
-
select
Set a custom SQL select for this item
Parameters:
-
select
StringThe SQL select entry that returns this item by name
Returns:
Return the field for chaining
Properties
orderBy
String
If we should sort queries by this field, null is no sort, can either be desc or asc
Default: null