Debreker Debreker - 9 months ago 143
PHP Question

Symfony production Mapping Exception FOSUserBundle

I have searched on stackoverflow for my problem, but I have not found an answer for my problem.

Currently I'm deploying my symfony project on my Debian server running PHP 5.6.26 following the documentation on the symfony website.

When I executed the command for installing my bundles by running the command

composer install --no-dev --optimize-autoloader

I get the following error:

Class "AppBundle\Entity\User" sub class of "FOS\UserBundle\Model\User" is not a valid entity or mapped super class.

I'm not having this error on my development machine's (Windows 10 desktop and a Macbook)

Currently I have no clue of what could be wrong. I did switch from annotation to yml later in the project.



namespace AppBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;

* User
class User extends BaseUser

public function __construct()

protected $id;

* @var \AppBundle\Entity\Address
private $address;

* Set address
* @param \AppBundle\Entity\Address $address
* @return User
public function setAddress(\AppBundle\Entity\Address $address = null)
$this->address = $address;

return $this;

* Get address
* @return \AppBundle\Entity\Address
public function getAddress()
return $this->address;

and my User.orm.yml file:

type: entity
table: user
repositoryClass: AppBundle\Repository\UserRepository
type: integer
id: true
strategy: AUTO
lifecycleCallbacks: { }

targetEntity: AppBundle\Entity\Address
cascade: ["persist", "remove"]

Answer Source

After seeing the answer of Alvin Bunk, I saw that the folder Resources (in src/AppBundle) was capitalized in his answer. After checking, my folder Resources was not capitalized.

my fix: Capitalize the folder Resources in src/AppBundle/