atkRelation atkRelation(
String
$name, String
$destination, [int
$flags = 0]
)
|
|
Constructor
Parameters:
|
String |
$name: |
The name of the relation. |
|
String |
$destination: |
The destination node (in module.name notation) |
|
int |
$flags: |
Flags for the relation |
void addDestinationFilter(
String
$filter
)
|
|
Adds a filter value to the destination filter.
Parameters:
|
String |
$filter: |
Filter to be added to the destination filter. |
Redefined in descendants as:
boolean createDestination(
)
|
|
Create the instance of the destination.
If succesful, the instance is stored in the m_destInstance member variable.
API Tags:
| Return: | true if succesful, false if something went wrong. |
Redefined in descendants as:
Since most relations do not store anything in a field, the default fieldtype for relations is "". Exceptions (like the many2oone relation, which stores a foreign key) can implement their own dbFieldType().
API Tags:
Redefinition of:
- atkAttribute::dbFieldType()
- Return the database field type of the attribute.
Redefined in descendants as:
String descriptor(
array
$record,
&$node, atkNode
$node
)
|
|
Descriptor handler. Forwards description handler calls to the real description handler.
Parameters:
|
array |
$record: |
The record |
|
atkNode |
$node: |
The atknode object |
|
|
&$node: |
|
API Tags:
| Return: | with the descriptor |
String display(
array
$record
)
|
|
Return a displayable string for a record.
Parameters:
|
array |
$record: |
The record that contains the information to display. |
API Tags:
| Return: | a displayable string for this value. |
Redefinition of:
- atkAttribute::display()
- Returns a displayable string for this value, to be used in HTML pages.
Redefined in descendants as:
Attempts to get a translated label which can be used when composing an "add" link
API Tags:
| Return: | Localised "add" label |
Redefined in descendants as:
string|array getChildSearchMode(
string|array
$searchmode, string
$childname
)
|
|
Get the searchmode for nested/child attributes.
Parameters:
|
string|array |
$searchmode: |
searchmode |
|
string |
$childname: |
the child attribute's name |
API Tags:
| Return: | the child searchmode |
| Access: | protected |
Object &getDescriptorHandler(
)
|
|
Get descriptor handler.
API Tags:
| Return: | descriptor handler |
String getDescriptorTemplate(
)
|
|
Returns the descriptor template for the destination node.
API Tags:
| Return: | The descriptor Template |
Returns an instance of the node that the relation points to.
API Tags:
| Return: | The node that this relation points to, or NULL if the destination is not valid. |
String getDestinationFilter(
)
|
|
Returns the destination filter.
API Tags:
| Return: | The destination filter. |
String getJoinCondition(
&$query, [string
$tablename = ""], [string
$fieldalias = ""], atkQuery
$query
)
|
|
Returns the condition (SQL) that should be used when we want to join a relation's owner node with the parent node.
Parameters:
|
atkQuery |
$query: |
The query object |
|
string |
$tablename: |
The tablename |
|
string |
$fieldalias: |
|
|
|
&$query: |
|
API Tags:
| Return: | SQL string for joining the owner with the destination. Defaults to false. |
Redefined in descendants as:
Retrieve the searchmodes supported by the relation.
API Tags:
| Return: | A list of supported searchmodes. |
Redefinition of:
- atkAttribute::getSearchModes()
- Retrieve the list of searchmodes supported by the attribute.
Redefined in descendants as:
boolean isEmpty(
array
$record
)
|
|
Check if the relation is empty
Parameters:
|
array |
$record: |
The record to check |
API Tags:
| Return: | true if a destination record is present. False if not. |
Redefinition of:
- atkAttribute::isEmpty()
- Check if a record has an empty value for this attribute.
Redefined in descendants as:
$filter parseFilter(
string
$destFilter, array
$record
)
|
|
Parses the destination filter
Parameters:
|
string |
$destFilter: |
filter to parse |
|
array |
$record: |
the current record |
API Tags:
void setDescriptorHandler(
&$handler, Object
$handler
)
|
|
Set descriptor handler.
Parameters:
|
Object |
$handler: |
The descriptor handler. |
|
|
&$handler: |
|
void setDescriptorTemplate(
String
$template
)
|
|
Sets the descriptor template for the destination node.
Parameters:
|
String |
$template: |
The descriptor template. |
void setDestinationFilter(
String
$filter
)
|
|
Sets the destination filter.
Parameters:
|
String |
$filter: |
The destination filter. |
Redefined in descendants as:
void validate(
&$record, String
$mode, array
$record
)
|
|
Validation method. Empty implementation. Derived classes may override this function.
Parameters:
|
array |
$record: |
The record that holds the value for this attribute. If an error occurs, the error will be stored in the 'atkerror' field of the record. |
|
String |
$mode: |
The mode for which should be validated ("add" or "update") |
|
|
&$record: |
|
API Tags:
Redefinition of:
- atkAttribute::validate()
- Checks if a value is valid.
Redefined in descendants as:
string _cleanupDestinationFilter(
string
$filter
)
|
|
Remove redundant (more than 1 subsequently) spaces from the filter string.
This prevents the filter from rapidly becoming too long to be passed in the URL if enters are used in code to make the filter readable.
Parameters: