Jump to content

AtkExpressionAttribute: Difference between revisions

From NusaATK
Sams90 (talk | contribs)
No edit summary
 
No edit summary
Line 1: Line 1:
example:
example:


<syntaxhighlight lang="php">
$this->add(new atkExpressionAttribute("employee_count", "SELECT COUNT(*) FROM employee_department ed WHERE ed.department_id = [table].id"));
$this->add(new atkExpressionAttribute("employee_count", "SELECT COUNT(*) FROM employee_department ed WHERE ed.department_id = [table].id"));
</syntaxhighlight>


This gives you a nice overview of the number of employees in each department in the admin overview of the department node.
This gives you a nice overview of the number of employees in each department in the admin overview of the department node.

Revision as of 21:34, 17 December 2007

example:

$this->add(new atkExpressionAttribute("employee_count", "SELECT COUNT(*) FROM employee_department ed WHERE ed.department_id = [table].id"));

This gives you a nice overview of the number of employees in each department in the admin overview of the department node.

Any SQL expression can be used and you can reference the node's table using the [table] block.

Note: http://www.achievo.org/forum/viewtopic.php?t=2409&highlight=atkexpressionattribute