Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Object of class Proxies__CG__AppBundleEntityUser could not be converted to string").
- /**
- * @ORMEntity
- * @ORMTable(name="user")
- * @UniqueEntity(fields={"email"}, message="It looks like your already have an account!")
- */
- class User implements UserInterface
- {
- /**
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- * @ORMColumn(type="integer")
- */
- private $id;
- /**
- * @AssertNotBlank()
- * @AssertEmail()
- * @ORMColumn(type="string", unique=true)
- */
- private $email;
- /**
- * @ORMColumn(type="string")
- */
- private $password;
- /**
- * @AssertNotBlank(groups={"Registration"})
- * @var string
- */
- private $plainPassword;
- /**
- * @ORMColumn(type="json_array")
- */
- private $roles = array();
- /**
- * @ORMOneToMany(targetEntity="Comment", mappedBy="author")
- */
- private $user;
- public function __construct()
- {
- $this->user = new ArrayCollection();
- }
- public function getUsername()
- {
- return $this->email;
- }
- public function getRoles()
- {
- $roles = $this->roles;
- if (!in_array('ROLE_USER', $roles))
- {
- $roles[] = 'ROLE_USER';
- }
- return $roles;
- }
- /**
- * @return mixed
- */
- public function getId()
- {
- return $this->id;
- }
- public function getPassword()
- {
- return $this->password;
- }
- public function getSalt()
- {
- }
- public function getEmail()
- {
- return $this->email;
- }
- public function eraseCredentials()
- {
- $this->plainPassword = null;
- }
- /**
- * @param mixed $email
- */
- public function setEmail($email)
- {
- $this->email = $email;
- }
- /**
- * @param mixed $password
- */
- public function setPassword($password)
- {
- $this->password = $password;
- }
- /**
- * @return mixed
- */
- public function getPlainPassword()
- {
- return $this->plainPassword;
- }
- /**
- * @param mixed $plainPassword
- */
- public function setPlainPassword($plainPassword)
- {
- $this->plainPassword = $plainPassword;
- $this->password = null;
- }
- /**
- * @param mixed $roles
- */
- public function setRoles($roles)
- {
- $this->roles = $roles;
- }
- /**
- * @return mixed
- */
- public function getUser()
- {
- return $this->user;
- }
- }
- /**
- * @ORMEntity(repositoryClass="AppBundleRepositoryCommentRepository")
- * @ORMTable(name="comments")
- */
- class Comment
- {
- public function __construct()
- {
- $this->publishedAt = new DateTime();
- }
- /**
- * @ORMColumn(type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var Product
- *
- * @ORMManyToOne(targetEntity="AppBundleEntityProduct")
- * @ORMJoinColumn(nullable=false)
- */
- private $product;
- /**
- * @var string
- *
- * @ORMColumn(type="text")
- * @AssertLength(
- * min=5,
- * minMessage="Comment is too short!",
- * max=10000,
- * maxMessage="Comment is too long!"
- * )
- */
- private $content;
- /**
- * @var User
- *
- * @ORMManyToOne(targetEntity="AppBundleEntityUser", inversedBy="user")
- * @ORMJoinColumn(name="author_id", referencedColumnName="id")
- */
- private $author;
- /**
- * @var DateTime
- *
- * @ORMColumn(type="datetime")
- * @AssertDateTime
- */
- private $publishedAt;
- /**
- * @ORMManyToOne(targetEntity="AppBundleEntityComment")
- * @ORMJoinColumn(nullable=false)
- */
- private $comment;
- /**
- * @return mixed
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @param mixed $id
- */
- public function setId($id)
- {
- $this->id = $id;
- }
- /**
- * @return Product
- */
- public function getProduct()
- {
- return $this->product;
- }
- /**
- * @param Product $product
- */
- public function setProduct($product)
- {
- $this->product = $product;
- }
- /**
- * @return string
- */
- public function getContent()
- {
- return $this->content;
- }
- /**
- * @param string $content
- */
- public function setContent($content)
- {
- $this->content = $content;
- }
- /**
- * @return User
- */
- public function getAuthor()
- {
- return $this->author;
- }
- /**
- * @param User $author
- */
- public function setAuthor($author)
- {
- $this->author = $author;
- }
- /**
- * @return DateTime
- */
- public function getPublishedAt()
- {
- return $this->publishedAt;
- }
- /**
- * @param DateTime $publishedAt
- */
- public function setPublishedAt($publishedAt)
- {
- $this->publishedAt = $publishedAt;
- }
- /**
- * @return mixed
- */
- public function getCommentlist()
- {
- return $this->comment;
- }
- /**
- * @param mixed $commentlist
- */
- public function setCommentlist($comment)
- {
- $this->comment = $comment;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement