Hello,
I have a model with two relations:
$this->hasMany(
            'objectKey',
            CatalogArticle::class,
            'parentKey',
            ['alias' => 'subArticles']
        );
$this->belongsTo(
            'objectKey',
            Object::class,
            'id',
            ['alias' => 'object']
        );      in the model the primaryKey is ObjectKey and I also have a status field with -1 or 1.
I want to have the count of subArticles with status >0 using relations for a given objectKey value
I could have
$nbSubArticles = count(CatalogArticle::findFirstByObjectKey(41)->subArticles); but this gives me even those with status = -1, I don't want them.
Any idea? I don't want to create a custom query for that, i would use the relation and models.