use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use FR3D\LdapBundle\Model\LdapUserInterface;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser implements LdapUserInterface
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
private $dn;
/**
* the constructor
*/
public function __construct() {
parent::__construct();
// your own logic
}
/**
* {@inheritDoc}
*/
public function getDn() {
return $this->dn;
}
/**
* {@inheritDoc}
*/
public function setDn($dn) {
$this->dn = $dn;
}
}
Thanks a lot in advance!
FOSUserBundle is in an state of transition right now so it depends a bit on exactly what version you have.
You probably need:
use FOS\UserBundle\Entity\User as BaseUser; // Note Entity instead of Model
To get the base attributes. They are shifting things to the Model which explains why you may have seen Model\\User in the documentation. But no stable release has been made yet.
You could try changing composer.json to: "friendsofsymfony/user-bundle": "dev-master", and doing an update. Or just do an update if you are already using dev-master.
After which the Model base should work. However, some of your other code might stop working.
It's all very unstable right now.
Of course you also have to have your doctrine mappings set right:
mappings:
FOSUserBundle: ~
MyBundle: ~
But I assume you have this because you first got FOSUserBundle working before you tried adding Ldap. You did right?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.