My plugin has a custom ResponseRecord with relations to a UserRecord and ElementRecord as follows:

public function defineRelations()
    return array(
        'user' => array(static::BELONGS_TO, 'UserRecord', 'user_id', 'required' => true, 'onDelete' => static::CASCADE),
        'element' => array(static::BELONGS_TO, 'ElementRecord', 'question_id', 'required' => true, 'onDelete' => static::CASCADE),

Can I query custom fields on the user or element models when querying with findAll() on this custom ResponseRecord record? If not, is there a more efficient way than iterating through all ResponseModel and UserModel?

For example, I need to query where user.industry (custom text field) is 'Agriculture' and where the ResponseRecord's year attribute is 2016.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.