I've read here (Section: Temporarily Modifying Attribute Visibility) that we can hide object properties temporarily.
Is it possible to also hide children attributes?
For example:
//User model
class User extends \App\AppModel
{
public function articles()
{
return $this->hasMany(Article::class);
}
}
Exclude from array here:
$user = User::find($id);
$userData = $user->makeHidden(['last_name', 'articles.*.user_id'])->toArray();
dd($userData); //user_id still present in articles :(