- /src/Application/MiSuperAPP/UserBundle/Entity/User.php
- /src/Application/MiSuperInvento/UserBundle/Entity/Group.php
- /src/Application/MiSuperInvento/UserBundle/Resources/config/doctrine/User.orm.xml
- /src/Application/MiSuperInvento/UserBundle/Resources/config/doctrine/Group.orm.xml
1 2 3 4 5 |
namespace Application\MiSuperInvento\UserBundle\Entity; use Sonata\UserBundle\Entity\BaseUser as BaseUser; class User extends BaseUser implements UserInterface { .. |
1 2 3 4 5 6 |
namespace Application\MiSuperInvento\UserBundle\Entity; use FOS\UserBundle\Model\User as BaseUser; use Sonata\UserBundle\Model\UserInterface; class User extends BaseUser implements UserInterface { ... |
Nótese que, en nuestro caso, hemos utilizado el FOSUserBundle integrado en el bundle de sonata. En caso de utilizar el bundle sin sonata, la ruta sería: /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Model/User.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
namespace Application\MiSuperInvento\UserBundle\Entity; use FOS\UserBundle\Model\User as BaseUser; use Sonata\UserBundle\Model\UserInterface; class User extends BaseUser implements UserInterface { /** * @var \DateTime */ protected $createdAt; /** * @var \DateTime */ protected $updatedAt; ... / * Sets the creation date * * @param \DateTime|null $createdAt */ public function setCreatedAt(\DateTime $createdAt = null) { $this->createdAt = $createdAt; } /** * Returns the creation date * * @return \DateTime|null */ public function getCreatedAt() { return $this->createdAt; } ... } |
1 2 3 4 |
namespace Application\MiSuperInvento\UserBundle\Entity; use FOS\UserBundle\Model\Group as BaseGroup; class Group extends BaseGroup implements \FOS\UserBundle\Model\GroupInterface { ... |
- /src/Application/MiSuperInvento/UserBundle/Resources/config/doctrine/User.orm.xml
- /src/Application/MiSuperInvento/UserBundle/Resources/config/doctrine/Group.orm.xml
1 2 3 4 5 6 7 8 9 10 11 12 |
<?xml version="1.0" encoding="UTF-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="Application\MiSuperInvento\UserBundle\Entity\Group" table="fos_user_group"> <id name="id" column="id" type="integer"> <generator strategy="AUTO" /> </id> </entity> </doctrine-mapping> |
Recuerda que, en caso de no utilizar el bundle de sonata, la ruta sería: /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/doctrine/User.orm.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?xml version="1.0" encoding="UTF-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <mapped-superclass name="FOS\UserBundle\Entity\User"> <field name="username" column="username" type="string" length="255" /> <field name="usernameCanonical" column="username_canonical" type="string" length="255" unique="true" /> <field name="email" column="email" type="string" length="255" /> <field name="emailCanonical" column="email_canonical" type="string" length="255" unique="true" /> <field name="enabled" type="boolean" column="enabled" nullable="false"/> <field name="salt" type="string" column="salt" length="255" nullable="false"/> <field name="password" type="string" column="password" length="255" nullable="false"/> ... </mapped-superclass> </doctrine-mapping> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?xml version="1.0" encoding="UTF-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="Application\MiSuperIvento\UserBundle\Entity\User" table="fos_user_user"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> </id> <field name="username" type="string" column="username" length="255" nullable="false"/> <field name="usernameCanonical" column="username_canonical" type="string" length="255"/> <field name="email" type="string" column="email" length="255" nullable="false"/> <field name="emailCanonical" column="email_canonical" type="string" length="255" /> <field name="enabled" type="boolean" column="enabled" nullable="false"/> <field name="salt" type="string" column="salt" length="255" nullable="false"/> <field name="password" type="string" column="password" length="255" nullable="false"/> ... </entity> </doctrine-mapping> |