/** * @param User $user * @return Diagram[] All diagrams the user have saved */ public function getByUser(User $user) { return $this->database->select(Diagram::class, '`userId` = ?', [$user->getId()]); }
public function __construct($id, User $user) { $this->id = $id; $this->userId = $user->getId(); }