Guest User

Untitled

a guest
Jan 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. use DoctrineORMMapping as ORM;
  2. use DoctrineCommonCollectionsArrayCollection;
  3.  
  4. /**
  5. * @ORMEntity
  6. * @ORMTable(name="player")
  7. */
  8. class Player
  9. {
  10. /**
  11. * @ORMId
  12. * @ORMColumn(type="integer")
  13. * @ORMGeneratedValue(strategy="AUTO")
  14. */
  15. protected $id;
  16.  
  17. protected $name;
  18.  
  19. protected $urlAvatar;
  20.  
  21. /**
  22. * @ORMColumn(type="integer")
  23. */
  24. protected $coins;
  25.  
  26. /**
  27. * @ORMColumn(type="integer")
  28. */
  29. protected $money;
  30.  
  31. /**
  32. * @ORMOneToMany(targetEntity="Mercenary", mappedBy="player")
  33. */
  34. protected $mercenaries;
  35.  
  36. public function __construct()
  37. {
  38. $this->mercenaries = new ArrayCollection();
  39. }
  40.  
  41. /**
  42. * Get id
  43. *
  44. * @return integer
  45. */
  46. public function getId()
  47. {
  48. return $this->id;
  49. }
  50.  
  51. /**
  52. * Set coins
  53. *
  54. * @param integer $coins
  55. */
  56. public function setCoins($coins)
  57. {
  58. $this->coins = $coins;
  59. }
  60.  
  61. /**
  62. * Get coins
  63. *
  64. * @return integer
  65. */
  66. public function getCoins()
  67. {
  68. return $this->coins;
  69. }
  70.  
  71. /**
  72. * Set money
  73. *
  74. * @param integer $money
  75. */
  76. public function setMoney($money)
  77. {
  78. $this->money = $money;
  79. }
  80.  
  81. /**
  82. * Get money
  83. *
  84. * @return integer
  85. */
  86. public function getMoney()
  87. {
  88. return $this->money;
  89. }
  90.  
  91. /**
  92. * Add mercenaries
  93. *
  94. * @param IFZTowerofDimensionsBundleEntityMercenary $mercenaries
  95. */
  96. public function addMercenary(IFZTowerofDimensionsBundleEntityMercenary $mercenaries)
  97. {
  98. $this->mercenaries[] = $mercenaries;
  99. }
  100.  
  101. /**
  102. * Get mercenaries
  103. *
  104. * @return DoctrineCommonCollectionsCollection
  105. */
  106. public function getMercenaries()
  107. {
  108. return $this->mercenaries;
  109. }
  110. }
  111.  
  112. {% for mercenary in player.mercenaries %}
  113. {# do whatever you want with mercenary #}
  114. {% endfor %}
Add Comment
Please, Sign In to add comment