CakePHP 3.x从实体获取合适的数据

I'm starting to use CakePHP 3.x and wondering how to do such functionality in correct way?

$articles = $userEntity->getAccosiatedArticles()

Just use the contain for retrieving Associated data.

$articles = $userEntity->find('all',[
            'contain'=>['Articles']
        ]);

for this you have to declare the has_many(in this case) association in User model.

$this->hasMany('Articles');

The correct way would be to use $usersTable->loadInto($userEntity, ['Articles']). You can also use the lazy loader plugin: https://github.com/jeremyharris/cakephp-lazyload