Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. 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").
  2.  
  3. /**
  4. * @ORMEntity
  5. * @ORMTable(name="user")
  6. * @UniqueEntity(fields={"email"}, message="It looks like your already have an account!")
  7. */
  8. class User implements UserInterface
  9. {
  10. /**
  11. * @ORMId
  12. * @ORMGeneratedValue(strategy="AUTO")
  13. * @ORMColumn(type="integer")
  14. */
  15. private $id;
  16.  
  17. /**
  18. * @AssertNotBlank()
  19. * @AssertEmail()
  20. * @ORMColumn(type="string", unique=true)
  21. */
  22. private $email;
  23.  
  24. /**
  25. * @ORMColumn(type="string")
  26. */
  27. private $password;
  28.  
  29. /**
  30. * @AssertNotBlank(groups={"Registration"})
  31. * @var string
  32. */
  33. private $plainPassword;
  34.  
  35. /**
  36. * @ORMColumn(type="json_array")
  37. */
  38. private $roles = array();
  39.  
  40. /**
  41. * @ORMOneToMany(targetEntity="Comment", mappedBy="author")
  42. */
  43. private $user;
  44.  
  45. public function __construct()
  46. {
  47. $this->user = new ArrayCollection();
  48. }
  49.  
  50. public function getUsername()
  51. {
  52. return $this->email;
  53. }
  54.  
  55. public function getRoles()
  56. {
  57. $roles = $this->roles;
  58.  
  59. if (!in_array('ROLE_USER', $roles))
  60. {
  61. $roles[] = 'ROLE_USER';
  62. }
  63.  
  64. return $roles;
  65. }
  66.  
  67. /**
  68. * @return mixed
  69. */
  70. public function getId()
  71. {
  72. return $this->id;
  73. }
  74.  
  75. public function getPassword()
  76. {
  77. return $this->password;
  78. }
  79.  
  80. public function getSalt()
  81. {
  82. }
  83.  
  84. public function getEmail()
  85. {
  86. return $this->email;
  87. }
  88.  
  89. public function eraseCredentials()
  90. {
  91. $this->plainPassword = null;
  92. }
  93.  
  94. /**
  95. * @param mixed $email
  96. */
  97. public function setEmail($email)
  98. {
  99. $this->email = $email;
  100. }
  101.  
  102. /**
  103. * @param mixed $password
  104. */
  105. public function setPassword($password)
  106. {
  107. $this->password = $password;
  108. }
  109.  
  110. /**
  111. * @return mixed
  112. */
  113. public function getPlainPassword()
  114. {
  115. return $this->plainPassword;
  116. }
  117.  
  118. /**
  119. * @param mixed $plainPassword
  120. */
  121. public function setPlainPassword($plainPassword)
  122. {
  123. $this->plainPassword = $plainPassword;
  124. $this->password = null;
  125. }
  126.  
  127. /**
  128. * @param mixed $roles
  129. */
  130. public function setRoles($roles)
  131. {
  132. $this->roles = $roles;
  133. }
  134.  
  135. /**
  136. * @return mixed
  137. */
  138. public function getUser()
  139. {
  140. return $this->user;
  141. }
  142.  
  143. }
  144.  
  145. /**
  146. * @ORMEntity(repositoryClass="AppBundleRepositoryCommentRepository")
  147. * @ORMTable(name="comments")
  148. */
  149. class Comment
  150. {
  151. public function __construct()
  152. {
  153. $this->publishedAt = new DateTime();
  154. }
  155.  
  156. /**
  157. * @ORMColumn(type="integer")
  158. * @ORMId
  159. * @ORMGeneratedValue(strategy="AUTO")
  160. */
  161. private $id;
  162.  
  163. /**
  164. * @var Product
  165. *
  166. * @ORMManyToOne(targetEntity="AppBundleEntityProduct")
  167. * @ORMJoinColumn(nullable=false)
  168. */
  169. private $product;
  170.  
  171. /**
  172. * @var string
  173. *
  174. * @ORMColumn(type="text")
  175. * @AssertLength(
  176. * min=5,
  177. * minMessage="Comment is too short!",
  178. * max=10000,
  179. * maxMessage="Comment is too long!"
  180. * )
  181. */
  182. private $content;
  183.  
  184. /**
  185. * @var User
  186. *
  187. * @ORMManyToOne(targetEntity="AppBundleEntityUser", inversedBy="user")
  188. * @ORMJoinColumn(name="author_id", referencedColumnName="id")
  189. */
  190. private $author;
  191.  
  192. /**
  193. * @var DateTime
  194. *
  195. * @ORMColumn(type="datetime")
  196. * @AssertDateTime
  197. */
  198. private $publishedAt;
  199.  
  200. /**
  201. * @ORMManyToOne(targetEntity="AppBundleEntityComment")
  202. * @ORMJoinColumn(nullable=false)
  203. */
  204. private $comment;
  205.  
  206. /**
  207. * @return mixed
  208. */
  209. public function getId()
  210. {
  211. return $this->id;
  212. }
  213.  
  214. /**
  215. * @param mixed $id
  216. */
  217. public function setId($id)
  218. {
  219. $this->id = $id;
  220. }
  221.  
  222. /**
  223. * @return Product
  224. */
  225. public function getProduct()
  226. {
  227. return $this->product;
  228. }
  229.  
  230. /**
  231. * @param Product $product
  232. */
  233. public function setProduct($product)
  234. {
  235. $this->product = $product;
  236. }
  237.  
  238. /**
  239. * @return string
  240. */
  241. public function getContent()
  242. {
  243. return $this->content;
  244. }
  245.  
  246. /**
  247. * @param string $content
  248. */
  249. public function setContent($content)
  250. {
  251. $this->content = $content;
  252. }
  253.  
  254. /**
  255. * @return User
  256. */
  257. public function getAuthor()
  258. {
  259. return $this->author;
  260. }
  261.  
  262. /**
  263. * @param User $author
  264. */
  265. public function setAuthor($author)
  266. {
  267. $this->author = $author;
  268. }
  269.  
  270. /**
  271. * @return DateTime
  272. */
  273. public function getPublishedAt()
  274. {
  275. return $this->publishedAt;
  276. }
  277.  
  278. /**
  279. * @param DateTime $publishedAt
  280. */
  281. public function setPublishedAt($publishedAt)
  282. {
  283. $this->publishedAt = $publishedAt;
  284. }
  285.  
  286. /**
  287. * @return mixed
  288. */
  289. public function getCommentlist()
  290. {
  291. return $this->comment;
  292. }
  293.  
  294. /**
  295. * @param mixed $commentlist
  296. */
  297. public function setCommentlist($comment)
  298. {
  299. $this->comment = $comment;
  300. }
  301.  
  302. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement