Since you already get the User and the Tangle from the repo, just use setUser($user) cause for some weird reason the other way around inserts a null value.