我尝试安装 PUGXMultiUserBundle,现在当我执行所有步骤时,我尝试加载应用程序(仅主要位置:),http://localhost/jpp/web/app_dev.php
但我总是收到以下错误:
致命错误:无法在第 155 行的 C:\xampp\htdocs\JPP\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authentication\Token\AbstractToken.php 中实例化抽象类 JPP\UserBundle\Entity\User
我尝试了几件事都没有成功,请你帮帮我吗?您可以在下面找到我的实体类。我能够使用 GIT 在数据库中创建所有表。租用类位于:JPP/UserBundle/Entity。如果您需要更多文件,请告诉我...非常感谢!
罗杰
抽象用户类:
<?php
namespace JPP\UserBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="user")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({"userprofile" = "UserProfile", "usercompany" = "UserCompany"})
*
*/
abstract class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
类 UserCompany
<?php
// src/jpp/UserBundle/Entity/User.php
namespace JPP\UserBundle\Entity;
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="userCompany")
* @UniqueEntity(fields = "username", targetClass = "JPP\UserBundle\Entity\User", message="fos_user.username.already_used")
* @UniqueEntity(fields = "email", targetClass = "JPP\UserBundle\Entity\User", message="fos_user.email.already_used")
*/
class UserCompany extends User
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var integer
*
* @ORM\Column(name="usertype", type="integer")
*/
protected $userType;
/**
* @var string
*
* @ORM\Column(name="companyName", type="string", length=255)
*/
protected $companyName;
/**
* @var string
*
* @ORM\Column(name="sector", type="string", length=255)
*/
protected $sector;
/**
* @var string
*
* @ORM\Column(name="amountOfEmployees", type="string", length=255)
*/
protected $amountOfEmployees;
/**
* @var string
*
* @ORM\Column(name="turnover", type="string", length=255)
*/
protected $turnover;
/**
* @var string
*
* @ORM\Column(name="companyLink", type="string", length=255)
*/
protected $companyLink;
/**
* @var string
*
* @ORM\Column(name="facebookLink", type="string", length=255)
*/
protected $facebookLink;
/**
* @var string
*
* @ORM\Column(name="twitterLink", type="string", length=255)
*/
protected $twitterLink;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set userType
*
* @param integer $userType
* @return UserType
*/
public function setUserType($userType)
{
$this->userType = $userType;
return $this;
}
/**
* Get userType
*
* @return integer
*/
public function getUserType()
{
return $this->userType;
}
/**
* Set companyName
*
* @param string $companyName
* @return Company
*/
public function setCompanyName($companyName)
{
$this->companyName = $companyName;
return $this;
}
/**
* Get companyName
*
* @return string
*/
public function getCompanyName()
{
return $this->companyName;
}
/**
* Set sector
*
* @param string $sector
* @return Company
*/
public function setSector($sector)
{
$this->sector = $sector;
return $this;
}
/**
* Get sector
*
* @return string
*/
public function getSector()
{
return $this->sector;
}
/**
* Set amountOfEmployees
*
* @param string $amountOfEmployees
* @return Company
*/
public function setAmountOfEmployees($amountOfEmployees)
{
$this->amountOfEmployees = $amountOfEmployees;
return $this;
}
/**
* Get amountOfEmployees
*
* @return string
*/
public function getAmountOfEmployees()
{
return $this->amountOfEmployees;
}
/**
* Set turnover
*
* @param string $turnover
* @return Company
*/
public function setTurnover($turnover)
{
$this->turnover = $turnover;
return $this;
}
/**
* Get turnover
*
* @return string
*/
public function getTurnover()
{
return $this->turnover;
}
/**
* Set companyLink
*
* @param string $companyLink
* @return Company
*/
public function setCompanyLink($companyLink)
{
$this->companyLink = $companyLink;
return $this;
}
/**
* Get companyLink
*
* @return string
*/
public function getCompanyLink()
{
return $this->companyLink;
}
/**
* Set facebookLink
*
* @param string $facebookLink
* @return Company
*/
public function setFacebookLink($facebookLink)
{
$this->facebookLink = $facebookLink;
return $this;
}
/**
* Get facebookLink
*
* @return string
*/
public function getFacebookLink()
{
return $this->facebookLink;
}
/**
* Set twitterLink
*
* @param string $twitterLink
* @return Company
*/
public function setTwitterLink($twitterLink)
{
$this->twitterLink = $twitterLink;
return $this;
}
/**
* Get twitterLink
*
* @return string
*/
public function getTwitterLink()
{
return $this->twitterLink;
}
}
类用户配置文件
// src/jpp/UserBundle/Entity/User.php
namespace JPP\UserBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity
* @ORM\Table(name="userProfile")
* @UniqueEntity(fields = "username", targetClass = "JPP\UserBundle\Entity\User", message="fos_user.username.already_used")
* @UniqueEntity(fields = "email", targetClass = "JPP\UserBundle\Entity\User", message="fos_user.email.already_used")
*/
class UserProfile extends User
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var integer
*
* @ORM\Column(name="usertype", type="integer")
*/
protected $userType;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $foreName;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $surName;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $street;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $plz;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $place;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $phone;
/**
* @ORM\Column(type="string", length=255)
*
*/
protected $mobile;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set userType
*
* @param integer $userType
* @return UserType
*/
public function setUserType($userType)
{
$this->userType = $userType;
return $this;
}
/**
* Get userType
*
* @return integer
*/
public function getUserType()
{
return $this->userType;
}
/**
* Set foreName
*
* @param string $foreName
* @return ForeName
*/
public function setForeName($foreName)
{
$this->foreName = $foreName;
return $this;
}
/**
* Get foreName
*
* @return string
*/
public function getForeName()
{
return $this->foreName;
}
/**
* Set surName
*
* @param string $surName
* @return SurName
*/
public function setSurName($surName)
{
$this->surName = $surName;
return $this;
}
/**
* Get surName
*
* @return string
*/
public function getSurName()
{
return $this->surName;
}
/**
* Set street
*
* @param string $street
* @return Street
*/
public function setStreet($street)
{
$this->street = $street;
return $this;
}
/**
* Get street
*
* @return string
*/
public function getStreet()
{
return $this->street;
}
/**
* Set plz
*
* @param string $plz
* @return PLZ
*/
public function setPlz($plz)
{
$this->plz = $plz;
return $this;
}
/**
* Get plz
*
* @return string
*/
public function getPlz()
{
return $this->plz;
}
/**
* Set place
*
* @param string $place
* @return Place
*/
public function setPlace($place)
{
$this->place = $place;
return $this;
}
/**
* Get place
*
* @return string
*/
public function getPlace()
{
return $this->place;
}
/**
* Set phone
*
* @param string $phone
* @return Phone
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set mobile
*
* @param string $mobile
* @return Mobile
*/
public function setMobile($mobile)
{
$this->mobile = $mobile;
return $this;
}
/**
* Get mobile
*
* @return string
*/
public function getMobile()
{
return $this->mobile;
}
//public function __construct()
//{
// parent::__construct();
// your own logic
//}
}