Same table can be used multiple times to define different types of associations

How can I use this snippet of the Book (Associations - Linking Tables Together) :

class ArticlesTable extends Table
{
public function initialize(array $config): void
{
$this->hasMany(‘Comments’)
->setFinder(‘approved’);

    $this->hasMany('UnapprovedComments', [
            'className' => 'Comments'
        ])
        ->setFinder('unapproved')
        ->setProperty('unapproved_comments');
}

}

After adding a column ‘approved’ (type boolean) to the comments table I get:

Unknown finder method “approved” on App\Model\Table\CommentsTable.

Do they want 2 columns approved and unapproved?

CommentsTable:

public function initialize(array $config): void
{
parent::initialize($config);

    $this->setTable('comments');
    $this->setDisplayField('id');
    $this->setPrimaryKey('id');

    $this->addBehavior('Timestamp');

    $this->belongsTo('Users', [
        'foreignKey' => 'user_id',
        'joinType' => 'INNER',
    ]);
    $this->belongsTo('Articles', [
        'foreignKey' => 'article_id',
        'joinType' => 'INNER',
    ]);
}

If you are naming a finder in the association, you have to define that finder

In your example you have to add findApproved and findUnapproved to CommentsTable