public function changeBckImage(UserFile $image, User $user) { $webpath = '/files/resources/desktop-images/' . $user->getUsername() . '/'; $apppath = __DIR__ . '/../../../../web'; $fs = new Filesystem(); if ($this->getBackgroundImage() !== ServerConstants::DEFAULT_BACKGROUND_IMAGE) { $fs->remove($apppath . $this->getBackgroundImage()); } $fs->copy($apppath . $image->getWebPath(), $apppath . $webpath . $image->getName()); $this->setBackgroundImage($webpath . $image->getName()); return $this; }