I have found the new method of adding and expression to a model using ATK4.2.1 but I am having problems adding this to a CRUD view by without getting error "Method is not defined for this object".
Is this possible? Can an expression be viewed in a CRUD object?
Model Code
->addExpression('books_written')->set(function($select){
return $select->dsql()
->table('book')
->field($select->expr('count(*)'))
->where('author_id',$select->getField('id'));
}
});
Page Method that causes the error by the addition of 'isUser' to the field list.
$crud = $AddressBook->add('CRUD');
$crud->setModel('PersonLockedAccount',array('firstName','lastName','email','mobile','isUser'))->addCondition('account_id',$accountId)->addCondition('id','!=',$personId);