Archive for March, 2011

Just managed to count another table using a model virtual field, obviously preserving the association with the sub query conditions.
So in my ProductTemplate model I have this:
123var $virtualFields = array(
    ‘page_count’ => ‘SELECT COUNT(*) FROM pages as Page WHERE Page.product_template_id = ProductTemplate.id’
  );
The nice thing about this is you can use the field with [...]


top