Constructor
SchemaField
SchemaField
(string $label, string $name, string $type, [optional $description = ""], [optional $mult = false], [optional $required = false], [optional $active = true])
-
string
$label: the unique label for this field.
-
string
$name: the field's display name
-
string
$type: The string name as registered with the DataTypeManager of the data type (ie, "string", "integer", "boolean", etc)
-
optional
$description: string $description a description for this field
-
optional
$mult: boolean $mult flag specifying if multiple values are allowed
-
optional
$required: boolean $required flag specifying if we will disallow a database commit without at least one value for this field
-
optional
$active: boolean $active flag specifying if this field is to be used or no.
Flags that we should add ourselves to the databse as a new row upon commit().
void
addToDB
()
After being added to a Schema, it calls associate() to tie us to its type. This way, we can only be added to one Schema.
void
associate
(ref $schema)
-
ref
$schema: object $schema The schema to which we are being added.
Reflects any changes made locally to the database.
int
commit
([optional $id = null])
-
optional
$id: int $id The ID in the database to update (if not adding...).
Flags that we should deactivate ourselves upon commit()
void
delete
()
Returns this field's description.
string
getDescription
()
Returns our display name.
string
getDisplayName
()
Returns this field's ID (assuming it has been associated with a Schema)
string
getID
()
Returns our text-label.
string
getLabel
()
Returns if this field is allowed to have multiple values.
bool
getMultFlag
()
Returns the DataType registered with the DataTypeManager that we are tied to.
string
getType
()
Returns if this field is active within the Schema or not.
bool
isActive
()
Returns if this field is required to hold at least one value.
bool
isRequired
()
Returns a replica of this object.
ref
replicate
()
Sets if this field should be active within the Schema.
void
setActiveFlag
(bool $bool)
Sets if this field is allowed to have multiple values.
void
setMultFlag
(bool $mult)
Sets if this field should be required or not.
void
setRequired
(bool $req)
Flags that we should update an existing row in the database upon commit().
void
update
()
Sets this field's description.
void
updateDescription
(string $description)
Sets this field's display name.
void
updateDisplayName
(string $name)