Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions

DateItem Class Reference

Date item object. More...

Inheritance diagram for DateItem:
BEAppModel AppModel

List of all members.

Public Member Functions

 getColumnType ($column)
 Returns the column type of a column in the model.
 stringToTimestamp ($date)
 Convert a string to timestamp.
 beforeValidate ()
 Runs actual validation rules.
 beforeFind (array $queryData)
 Before find condition formatting.
 afterFind ($results)
 After find data formatting.
 loadDateItemsCalendar ($startDay, $endDay)
 Load calendar date items in the time window specified.
 apiTransformer (array $options=array())
 Return an array of column types to transform (cast) Used to build consistent REST APIs.

Public Attributes

 $recursive = 0
 $validate = array()

Protected Member Functions

 filterParams (array $params)
 Filter out valid parameter keys.
 prepareDate ($column, $date)
 Prepares one or more dates in the correct format for the underlying database structure (either `DATETIME` or `BIGINT`).

Static Protected Member Functions

static addToCalendar (array &$calendar, array $dateItem)
 Add a DateItem to the calendar with respect of time order.

Detailed Description

Date item object.

Definition at line 25 of file date_item.php.


Member Function Documentation

static DateItem::addToCalendar ( array &$  calendar,
array $  dateItem 
) [static, protected]

Add a DateItem to the calendar with respect of time order.

Parameters:
array $calendar Calendar.
array $dateItem DateItem to be added.

Definition at line 271 of file date_item.php.

Referenced by loadDateItemsCalendar().

DateItem::afterFind ( results  ) 

After find data formatting.

Parameters:
mixed $results Found results.
Returns:
array Formatted results.

Definition at line 241 of file date_item.php.

References filterParams().

DateItem::apiTransformer ( array $  options = array()  ) 

Return an array of column types to transform (cast) Used to build consistent REST APIs.

Add to table fields type 'days' as 'integerArray' to convert ["0", "1", ...] in [0, 1, ...]

Possible options are:

  • 'castable' an array of fields that the rest api would be cast to
See also:
AppModel::apiTransformer()
Parameters:
array $options
Returns:
array

Definition at line 398 of file date_item.php.

DateItem::beforeFind ( array $  queryData  ) 

Before find condition formatting.

Parameters:
array $queryData Array with query data.
Returns:
array Array with modified query data.

Definition at line 228 of file date_item.php.

DateItem::beforeValidate (  ) 

Runs actual validation rules.

If supplied values aren't valid, they are silently removed.

Returns:
bool Returns `true`.

Prepare start/end dates.

Prepare params.

Definition at line 191 of file date_item.php.

References filterParams(), and prepareDate().

DateItem::filterParams ( array $  params  )  [protected]

Filter out valid parameter keys.

Parameters:
array $params Array of potential parameters.
Returns:
array Filtered array of parameters.

Definition at line 63 of file date_item.php.

Referenced by afterFind(), and beforeValidate().

DateItem::getColumnType ( column  ) 

Returns the column type of a column in the model.

Parameters:
string $column The name of the model column.
Returns:
string Column type.
See also:
Model::getColumnType()

Definition at line 48 of file date_item.php.

Referenced by prepareDate().

DateItem::loadDateItemsCalendar ( startDay,
endDay 
)

Load calendar date items in the time window specified.

Returns array containing a list of object IDs with matching date items, and a list of DateItems for each day.

Parameters:
string $startDay Start date, using the format `YYYY-MM-DD`, i.e. `2014-02-28`.
string $endDay End date (not included), using the format `YYYY-MM-DD`, i.e. `2014-03-14`.
Returns:
array, containing "objIds" => array of object id matched, "calendar" => associative array having "date" as key and date items as values

Find all events in range.

Start date.

End date.

Single-day date item.

Recurring event.

Definition at line 303 of file date_item.php.

References addToCalendar().

DateItem::prepareDate ( column,
date 
) [protected]

Prepares one or more dates in the correct format for the underlying database structure (either `DATETIME` or `BIGINT`).

Parameters:
string $column The name of the model column.
mixed $date Date (or array of dates) to be prepared.
Returns:
mixed Prepared date(s).

Definition at line 127 of file date_item.php.

References getColumnType(), and stringToTimestamp().

Referenced by beforeValidate().

DateItem::stringToTimestamp ( date  ) 

Convert a string to timestamp.

This function is safe with years after 9999 or before -9999.

Parameters:
string $date Date to be converted.
Returns:
int|null Timestamp.

Fix timestamp for 5+-digit years.

Definition at line 93 of file date_item.php.

Referenced by prepareDate().


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:46 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus