Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use DoctrineORMMapping as ORM;
- use DoctrineCommonCollectionsArrayCollection;
- /**
- * @ORMEntity
- * @ORMTable(name="player")
- */
- class Player
- {
- /**
- * @ORMId
- * @ORMColumn(type="integer")
- * @ORMGeneratedValue(strategy="AUTO")
- */
- protected $id;
- protected $name;
- protected $urlAvatar;
- /**
- * @ORMColumn(type="integer")
- */
- protected $coins;
- /**
- * @ORMColumn(type="integer")
- */
- protected $money;
- /**
- * @ORMOneToMany(targetEntity="Mercenary", mappedBy="player")
- */
- protected $mercenaries;
- public function __construct()
- {
- $this->mercenaries = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set coins
- *
- * @param integer $coins
- */
- public function setCoins($coins)
- {
- $this->coins = $coins;
- }
- /**
- * Get coins
- *
- * @return integer
- */
- public function getCoins()
- {
- return $this->coins;
- }
- /**
- * Set money
- *
- * @param integer $money
- */
- public function setMoney($money)
- {
- $this->money = $money;
- }
- /**
- * Get money
- *
- * @return integer
- */
- public function getMoney()
- {
- return $this->money;
- }
- /**
- * Add mercenaries
- *
- * @param IFZTowerofDimensionsBundleEntityMercenary $mercenaries
- */
- public function addMercenary(IFZTowerofDimensionsBundleEntityMercenary $mercenaries)
- {
- $this->mercenaries[] = $mercenaries;
- }
- /**
- * Get mercenaries
- *
- * @return DoctrineCommonCollectionsCollection
- */
- public function getMercenaries()
- {
- return $this->mercenaries;
- }
- }
- {% for mercenary in player.mercenaries %}
- {# do whatever you want with mercenary #}
- {% endfor %}
Add Comment
Please, Sign In to add comment