Db_ColumnDefinition class
Defined in |
/phproad/modules/db/classes/db_columndefinition.php, lines 12-596 |
Author |
LemonStand eCommerce Inc. |
Represents a model column definition.
Objects of this class are used for defining presentation and validation field properties in models.
List Behavior and Form Behavior use data from the
column definition objects to output correct field labels and format field data.
Property |
Type |
Description |
Defined By |
dbName |
string |
specifies the database column name. |
Db_ColumnDefinition |
displayName |
string |
specifies the visual column name. |
Db_ColumnDefinition |
type |
string |
specifies the column type. |
Db_ColumnDefinition |
Method |
Description |
Defined By |
currency() |
indicates that the column value should be formatted as currency. |
Db_ColumnDefinition |
dateAsIs() |
disables timezone conversion for datetime fields. |
Db_ColumnDefinition |
dateFormat() |
specifies the date format. |
Db_ColumnDefinition |
defaultInvisible() |
makes the column invisible in lists by default. |
Db_ColumnDefinition |
invisible() |
hides the column from lists. |
Db_ColumnDefinition |
length() |
sets the maximum length for displaying varchar and text values in lists. |
Db_ColumnDefinition |
listNoTitle() |
allows to hide the column list title. |
Db_ColumnDefinition |
listTitle() |
sets column title for lists. |
Db_ColumnDefinition |
noSorting() |
disables or enables sorting for the column in lists. |
Db_ColumnDefinition |
order() |
indicates that lists should use this column as a sorting column by default. |
Db_ColumnDefinition |
precision() |
sets the precision for displaying floating point numbers in lists. |
Db_ColumnDefinition |
timeFormat() |
specifies the time format. |
Db_ColumnDefinition |
type() |
specifies the column type. |
Db_ColumnDefinition |
validation() |
initializes and returns the validation rule set object. |
Db_ColumnDefinition |
Property details
¶
dbName property
public string $dbName;
Specifies the database column name.
¶
displayName property
public string $displayName;
Specifies the visual column name. This value is used
in list column titles and form labels.
¶
type property
public string $type;
Specifies the column type.
Method details
¶
currency() method
public Db_ColumnDefinition currency(boolean $value)
$value |
boolean |
enables or disables the feature. Pass TRUE value to display values as currency. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Indicates that the column value should be formatted as currency.
¶
dateAsIs() method
public Db_ColumnDefinition dateAsIs()
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Disables timezone conversion for datetime fields.
By default datetime fields are converted to GMT during saving and displayField() returns value converted
back to a time zone specified in TIMEZONE parameter in the configuration file (config.php). You can cancel this behavior
by calling this method.
¶
dateFormat() method
public Db_ColumnDefinition dateFormat(string $displayFormat)
$displayFormat |
string |
specifies the display format, compatible with strftime PHP function. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Specifies the date format.
The date format is used for displaying date and date/time field values in lists and forms.
¶
defaultInvisible() method
public Db_ColumnDefinition defaultInvisible()
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Makes the column invisible in lists by default.
Users can make the column visible by updating the list settings.
¶
invisible() method
public Db_ColumnDefinition invisible()
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Hides the column from lists.
¶
length() method
public Db_ColumnDefinition length(integer $length)
$length |
integer |
specifies the length value. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Sets the maximum length for displaying varchar and text values in lists.
Text values longer than the specified length get truncated.
¶
listNoTitle() method
public Db_ColumnDefinition listNoTitle(boolean $value=true)
$value |
boolean |
determines whether the title is invisible. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Allows to hide the column list title.
¶
listTitle() method
public Db_ColumnDefinition listTitle(string $title)
$title |
string |
specifies the column list title. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Sets column title for lists.
By default list column titles match column names. You can override the column name with this method.
¶
noSorting() method
public Db_ColumnDefinition noSorting(boolean $value=true)
$value |
boolean |
determines whether the column is not sortable. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Disables or enables sorting for the column in lists.
By default all columns are sortable in lists. You can use this method to disable sorting by a specific column.
¶
order() method
public Db_ColumnDefinition order(string $direction='asc')
$direction |
string |
specifies the sorting direction - asc or desc. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Indicates that lists should use this column as a sorting column by default.
List Behavior uses this feature until the user
chooses selects another sorting column.
¶
precision() method
public Db_ColumnDefinition precision(integer $precision)
$precision |
integer |
specifies the number of decimal places. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Sets the precision for displaying floating point numbers in lists.
¶
timeFormat() method
public Db_ColumnDefinition timeFormat(string $displayFormat)
$displayFormat |
string |
specifies the display format, compatible with strftime PHP function. |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Specifies the time format.
The date format is used for displaying date and date/time field values in lists and forms.
¶
type() method
public Db_ColumnDefinition type(string $typeName)
$typeName |
string |
specifies the type name
(see db_xxx constants in the description of Db_ActiveRecord class) |
{return} |
Db_ColumnDefinition |
returns the updated column definition object. |
Specifies the column type.
By default column types match the database column types, but you can use
this method to override the database column type and thus change the field
display parameters. For example, if you set the field type to db_number
for a varchar field, its value will be aligned to the right in lists and forms.
¶
validation() method
$customFormatMessage |
string |
specifies the format-specific validation message. |
$re_add |
boolean |
this parameter is for internal use. |
{return} |
Phpr_ValidationRules |
returns the validation object. |
Initializes and returns the validation rule set object.
Use the validation rule set object to configure the column validation parameters.
Note that validation is automatically enabled for date, datetime, float and numeric fields.
|