Closed harikt closed 9 years ago
how does your User entity looks like ?
<?php
namespace FOS\ReviewBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
When using 2.0.*@dev it is creating other fields.
@stof any idea what may be the reason ? I wonder why the same class works well for 2.x.dev version though. Is this a doctrine issue ?
For the 1.x branch you need extend the FOS\UserBundle\Entity\User
as the common mapping loading (using the Model subnamespace) was something that was added in 2.0.
@sstok Thank you. I wonder why the Model classes exists in 1.x version then.
@harikt The Model
class provides basic functionality that is extended by the class in, for example, the Entity
and Document
sub-namespaces.
@harikt in 1.x, the Entity and Document classes are extending the Model one, and are there to be able to rely on the auto_mapping of Doctrine integrations in Symfony. In 2.x, we simplified this by registering the mapping ourselves to be able to stop depending on the auto_mapping conventions to keep a single class.
Now I am looking at the classes.
namespace FOS\UserBundle\Entity;
use FOS\UserBundle\Model\User as AbstractUser;
abstract class User extends AbstractUser
{
}
Now I am not sure why not we can extend the class https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.3.x/Model/User.php
as I did previously. May be it is doctrine specific ?
@harikt you can extend the Model class directly, but you have to define all the mapping yourselves. In 1.3.x, the MappedSuperclass mapping is on the Entity class, not on the Model class, because of the usage of the auto_mapping to configure it.
Thank you @stof . I was struggling to find the answer. And now I find where it is written https://github.com/FriendsOfSymfony/FOSUserBundle/blob/v1.3.5/Resources/config/doctrine/User.orm.xml#L7 .
Thank you for the answer. I was using the documentation for master thinking it was for the last stable version and I was getting only the id.
Hi,
I have downloaded version 1.3.5 of fosuserbundle and after running it is only creating the id field.
Composer installed version of symfony, doctrine etc are as below