Skip to content

Latest commit

 

History

History
112 lines (89 loc) · 3.46 KB

fORMColumn.wiki

File metadata and controls

112 lines (89 loc) · 3.46 KB

Table of Contents

fORMColumn

<<css mode="next" class="sidebar"></css>> (((

Class Resources <<toc></toc>>

 - '''<a href="/docs/fORMColumn">Class Documentation</a>'''
 - <a href="/api/fORMColumn">API Reference</a>
 - <a href="https://github.com/flourishlib/flourish-classes/blob/master/fORMColumn.php" target="_blank">Source Code</a>

<<toc></toc>>

ORM Classes <<toc></toc>>

 - fActiveRecord
 - fRecordSet

 - fORM
 - '''fORMColumn'''
 - fORMDatabase
 - fORMDate
 - fORMFile
 - fORMJSON
 - fORMMoney
 - fORMOrdering
 - fORMRelated
 - fORMSchema
 - fORMValidation

)))

The fORMColumn class is an ORM plugin to provide miscellaneous additional functionality to individual columns.

Email Columns

The static method ::configureEmailColumn() sets a column to be validated as an email address. The first parameter is the `$class` the column is located in and the second parameter is the `$column`. As with most active record plugins, this method should normally be called from the `configure()` method.

Link Columns

Columns can be configured as a link column by passing the `$class` and `$column` to the static method fORMColumn::configureLinkColumn(). When the record is validated, the link will be checked to make sure it contains a valid domain name, however `http://` is not required. When calling the `prepare` method for the column, it will ensure that the link begings with `http://` for output into a HTML `` tag.

The above PHP would output the following:

Number Columns

While fActiveRecord automatically handles both integer and floating point numbers, sometimes it is necessary to have a column’s value be represented as an fNumber object. The static method ::configureNumberColumn() ensures that values loaded out of the database are automatically converted to an fNumber object. The first parameter is the `$class` and the second parameter is the `$column`.

Random Columns

In some situations a random string is useful for providing security when resetting passwords, validating email accounts or establishing access authentication. The static method ::configureRandomColumn() will cause a column to be set to a random string when the record is first saved and will allow generating a new random string at any time by calling `generateColumnName()`.

configureRandomColumn() accepts four parameters, the `$class` to be configured, the `$column`, the `$type` of random string (see fCryptography::randomString() for options) and the `$length` of the string.