Replaced yml with xml mapping files
							parent
							
								
									994e6e17cb
								
							
						
					
					
						commit
						1098e6c362
					
				| @ -0,0 +1,29 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||||
|     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|     xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../vendor/doctrine/orm/doctrine-mapping.xsd "> | ||||
| 
 | ||||
|     <entity name="App\Entity\Event"> | ||||
|         <id name="id" type="integer"> | ||||
|             <generator strategy="AUTO" /> | ||||
|         </id> | ||||
| 
 | ||||
|         <field name="type" type="integer" nullable="false" /> | ||||
|         <field name="version" type="integer" nullable="false" /> | ||||
| 
 | ||||
|         <one-to-many field="heroes" mapped-by="event" target-entity="EventHero"> | ||||
|             <cascade> | ||||
|                 <cascade-persist /> | ||||
|                 <cascade-merge /> | ||||
|             </cascade> | ||||
|         </one-to-many> | ||||
|         <one-to-many field="battles" mapped-by="event" target-entity="EventBattle"> | ||||
|             <cascade> | ||||
|                 <cascade-persist /> | ||||
|                 <cascade-merge /> | ||||
|             </cascade> | ||||
|         </one-to-many> | ||||
| 
 | ||||
| 
 | ||||
|     </entity> | ||||
| </doctrine-mapping> | ||||
| @ -0,0 +1,30 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <doctrine-mapping | ||||
| 	xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||||
| 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
| 	xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../vendor/doctrine/orm/doctrine-mapping.xsd "> | ||||
| 
 | ||||
| 	<entity name="App\Entity\EventBattle"> | ||||
| 		<id name="event" association-key="true" /> | ||||
| 		<id name="eid" type="integer" /> | ||||
| 
 | ||||
| 		<field name="value" type="json" /> | ||||
| 
 | ||||
| 		<many-to-one field="event" target-entity="Event" inversed-by="battles" /> | ||||
| 		<many-to-many field="heroes" target-entity="EventHero"> | ||||
| 		  <join-table name="event_battle_hero"> | ||||
|               <join-columns> | ||||
|                 <join-column name="event_id" referenced-column-name="event_id"></join-column> | ||||
|                 <join-column name="event_battle_id" referenced-column-name="eid"></join-column> | ||||
|               </join-columns> | ||||
|               <inverse-join-columns> | ||||
|                 <join-column name="event_id" referenced-column-name="event_id"></join-column> | ||||
|                 <join-column name="event_hero_id" referenced-column-name="eid"></join-column> | ||||
|               </inverse-join-columns> | ||||
| 		  </join-table> | ||||
| 		</many-to-many> | ||||
| 
 | ||||
| 	</entity> | ||||
| 
 | ||||
| 
 | ||||
| </doctrine-mapping> | ||||
| @ -0,0 +1,28 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||||
|     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|     xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../vendor/doctrine/orm/doctrine-mapping.xsd "> | ||||
| 
 | ||||
|     <entity name="App\Entity\EventHero"> | ||||
|         <id name="event" association-key="true" /> | ||||
|         <id name="eid" type="integer" /> | ||||
| 
 | ||||
|         <embedded name="skills" class="Skillz" /> | ||||
| 
 | ||||
|         <field name="name" type="string" length="32" unique="true" /> | ||||
|         <field name="team" type="integer" /> | ||||
| 
 | ||||
|         <many-to-one field="user" target-entity="User"> | ||||
|             <join-column on-delete="SET NULL" /> | ||||
|         </many-to-one> | ||||
| 
 | ||||
|         <many-to-one field="hero" target-entity="Hero"> | ||||
|             <join-column on-delete="SET NULL" /> | ||||
|         </many-to-one> | ||||
| 
 | ||||
|         <many-to-one field="event" target-entity="Event" inversed-by="heroes"> | ||||
|             <join-column on-delete="CASCADE" /> | ||||
|         </many-to-one> | ||||
| 
 | ||||
|     </entity> | ||||
| </doctrine-mapping> | ||||
| @ -0,0 +1,18 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||||
|     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|     xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../vendor/doctrine/orm/doctrine-mapping.xsd "> | ||||
| 
 | ||||
|     <entity name="App\Entity\Hero"> | ||||
|         <id name="id" type="integer"> | ||||
|             <generator strategy="AUTO" /> | ||||
|         </id> | ||||
| 
 | ||||
|         <embedded name="skills" class="Skillz" /> | ||||
| 
 | ||||
|         <field name="name" type="string" length="32" unique="true"/> | ||||
| 
 | ||||
|         <many-to-one field="user" target-entity="User" /> | ||||
| 
 | ||||
|     </entity> | ||||
| </doctrine-mapping> | ||||
| @ -1,24 +0,0 @@ | ||||
| App\Entity\Hero: | ||||
|     type: entity | ||||
|     repositoryClass: App\Repository\HeroRepository | ||||
|     table: hero | ||||
|     id: | ||||
|         id: | ||||
|             type: integer | ||||
|             generator: { strategy: AUTO } | ||||
|     fields: | ||||
|         name: | ||||
|             type: string | ||||
|             length: 32 | ||||
|             unique: true | ||||
|     embedded: | ||||
|         skills: | ||||
|             class: Skillz | ||||
| 
 | ||||
|     manyToOne: | ||||
|         user: | ||||
|             targetEntity: User | ||||
|             inversedBy: heroes | ||||
|             joinColumn: | ||||
|                 onDelete: CASCADE | ||||
|                 nullable: false | ||||
| @ -0,0 +1,22 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||||
|     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|     xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../vendor/doctrine/orm/doctrine-mapping.xsd "> | ||||
| 
 | ||||
|     <embeddable name="App\Entity\Skillz"> | ||||
|         <!-- basically the HP --> | ||||
|         <field name="constitution" type="integer" /> | ||||
| 
 | ||||
|         <!-- former MP! Some moves will require KI to function --> | ||||
|         <field name="ki" type="integer" /> | ||||
| 
 | ||||
|         <!-- damage dealer / block skill --> | ||||
|         <field name="strength" type="integer" /> | ||||
| 
 | ||||
|         <!-- evade / hit chance skill --> | ||||
|         <field name="agility" type="integer" /> | ||||
| 
 | ||||
|         <!-- if low => one is vulnerable for critical hits or slow attack speed / low damage --> | ||||
|         <field name="stamina" type="integer" /> | ||||
|     </embeddable> | ||||
| </doctrine-mapping> | ||||
| @ -1,18 +0,0 @@ | ||||
| App\Entity\Skillz: | ||||
|     type: embeddable | ||||
|     fields: | ||||
|         constitution: # basically the HP | ||||
|             type: integer | ||||
|             nullable: false | ||||
|         ki: # former MP! Some moves will require Ki to be available | ||||
|             type: integer | ||||
|             nullable: false | ||||
|         strength: # damage dealer / block skill? | ||||
|             type: integer | ||||
|             nullable: false | ||||
|         agility: # evade / hit chance skill?? | ||||
|             type: integer | ||||
|             nullable: false | ||||
|         stamina: # if low => one is vulnerable for critical hits or slow attack speed / low damage | ||||
|             type: integer | ||||
|             nullable: false | ||||
| @ -0,0 +1,24 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||||
|     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|     xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../vendor/doctrine/orm/doctrine-mapping.xsd "> | ||||
| 
 | ||||
|     <entity name="App\Entity\User"> | ||||
|         <id name="id" type="integer"> | ||||
|             <generator strategy="AUTO" /> | ||||
|         </id> | ||||
| 
 | ||||
|         <field name="username" type="string" length="32" unique="true" /> | ||||
|         <field name="password" /> | ||||
|         <field name="apiToken" unique="true" nullable="true" /> | ||||
|         <field name="roles" type="json" /> | ||||
| 
 | ||||
|         <one-to-many field="heroes" mapped-by="user" target-entity="Hero"> | ||||
|             <cascade> | ||||
|                 <cascade-persist /> | ||||
|                 <cascade-merge /> | ||||
|             </cascade> | ||||
|         </one-to-many> | ||||
| 
 | ||||
|     </entity> | ||||
| </doctrine-mapping> | ||||
| @ -1,26 +0,0 @@ | ||||
| App\Entity\User: | ||||
|     type: entity | ||||
|     repositoryClass: App\Repository\UserRepository | ||||
|     table: user | ||||
|     id: | ||||
|         id: | ||||
|             type: integer | ||||
|             generator: { strategy: AUTO } | ||||
|     fields: | ||||
|         username: | ||||
|             type: string | ||||
|             length: 32 | ||||
|             unique: true | ||||
|         password: # the hashed password | ||||
|             type: string | ||||
|         apiToken: | ||||
|             type: string | ||||
|             unique: true | ||||
|             nullable: true | ||||
|         roles: | ||||
|             type: json | ||||
|     oneToMany: | ||||
|         heroes: | ||||
|             targetEntity: Hero | ||||
|             mappedBy: user | ||||
|             cascade: ["persist", "merge"] | ||||
| @ -1,41 +1,42 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Controller; | ||||
| 
 | ||||
| use App\Repository\UserRepository; | ||||
| use FOS\RestBundle\Controller\Annotations as Rest; | ||||
| use FOS\RestBundle\Controller\AbstractFOSRestController; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
| use App\Entity\User; | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * @Rest\Route("api/user") | ||||
|  */ | ||||
| class UserController extends AbstractFOSRestController | ||||
| { | ||||
| 
 | ||||
|     protected UserRepository $userRepository; | ||||
|      | ||||
| 
 | ||||
|     public function __construct(UserRepository $userRepository) | ||||
|     { | ||||
|         $this->userRepository = $userRepository; | ||||
|     } | ||||
|      | ||||
| 
 | ||||
|     /** | ||||
|      * | ||||
|      * @Rest\Route("s") | ||||
|      * @Rest\View() | ||||
|      */ | ||||
|     public function cgetAction() : array | ||||
|     public function cgetAction(): array | ||||
|     { | ||||
|         return $this->userRepository->findAll(); | ||||
|     } | ||||
|      | ||||
| 
 | ||||
|     /** | ||||
|      * | ||||
|      * @Rest\Route("/{id}")) | ||||
|      * @Rest\View() | ||||
|      */ | ||||
|     public function getAction(int $id) : ?User | ||||
|     public function getAction(int $id): ?User | ||||
|     { | ||||
|         return $this->userRepository->find($id); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,47 @@ | ||||
| <?php | ||||
| namespace App\DataFixtures; | ||||
| 
 | ||||
| use Doctrine\Bundle\FixturesBundle\Fixture; | ||||
| use Doctrine\Common\DataFixtures\DependentFixtureInterface; | ||||
| use Doctrine\Persistence\ObjectManager; | ||||
| use App\Entity\EventBattle; | ||||
| use App\Entity\Event; | ||||
| use Psr\Log\LoggerInterface; | ||||
| use App\Entity\Hero; | ||||
| 
 | ||||
| class EventBattleFixtures extends Fixture implements DependentFixtureInterface | ||||
| { | ||||
| 
 | ||||
|     private LoggerInterface $logger; | ||||
| 
 | ||||
|     public function __construct(LoggerInterface $logger) | ||||
|     { | ||||
|         $this->logger = $logger; | ||||
|     } | ||||
| 
 | ||||
|     public function load(ObjectManager $manager) | ||||
|     { | ||||
|         /** | ||||
|          * | ||||
|          * @var Event $event | ||||
|          */ | ||||
|         $event = $this->getReference(EventFixtures::REF_1); | ||||
| 
 | ||||
|         $eventBattle = new EventBattle($event, 1); | ||||
|         $eventBattle->setEvent($event); | ||||
| 
 | ||||
|         $eventBattle->addHero($event->getHeroes()[0]); | ||||
|         $eventBattle->addHero($event->getHeroes()[1]); | ||||
| 
 | ||||
|         $manager->persist($eventBattle); | ||||
|         $manager->flush(); | ||||
|     } | ||||
| 
 | ||||
|     public function getDependencies() | ||||
|     { | ||||
|         return array( | ||||
|             EventHeroFixtures::class | ||||
|         ); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1,32 @@ | ||||
| <?php | ||||
| namespace App\DataFixtures; | ||||
| 
 | ||||
| use Doctrine\Bundle\FixturesBundle\Fixture; | ||||
| use Doctrine\Persistence\ObjectManager; | ||||
| use App\Entity\Event; | ||||
| 
 | ||||
| class EventFixtures extends Fixture | ||||
| { | ||||
| 
 | ||||
|     public const REF_1 = 'event-1-reference'; | ||||
|      | ||||
|     public const REF_2 = 'event-2-reference'; | ||||
|      | ||||
|      | ||||
|     public function load(ObjectManager $manager) | ||||
|     { | ||||
|         $event1 = new Event(); | ||||
|         $event1->setType(Event::FREE_BATTLE); | ||||
|         $manager->persist($event1); | ||||
|          | ||||
|         $event2 = new Event(); | ||||
|         $event2->setType(Event::TOURNAMENT); | ||||
|         $manager->persist($event2); | ||||
|          | ||||
|         $manager->flush(); | ||||
|          | ||||
|         $this->addReference(self::REF_1, $event1); | ||||
|         $this->addReference(self::REF_2, $event2); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1,44 @@ | ||||
| <?php | ||||
| namespace App\DataFixtures; | ||||
| 
 | ||||
| use Doctrine\Bundle\FixturesBundle\Fixture; | ||||
| use Doctrine\Persistence\ObjectManager; | ||||
| use Doctrine\Common\DataFixtures\DependentFixtureInterface; | ||||
| use App\Entity\EventHero; | ||||
| use App\Entity\Hero; | ||||
| use App\Entity\Event; | ||||
| 
 | ||||
| class EventHeroFixtures extends Fixture implements DependentFixtureInterface | ||||
| { | ||||
| 
 | ||||
|     public function load(ObjectManager $manager) | ||||
|     { | ||||
|         $heroUser1 = $this->getReference(UserFixtures::ADMIN_USER_REFERENCE)->getHeroes()[0]; | ||||
|         $heroUser2 = $this->getReference(UserFixtures::DUDE_USER_REFERENCE)->getHeroes()[0]; | ||||
| 
 | ||||
|         $event1 = $this->getReference(EventFixtures::REF_1); | ||||
| 
 | ||||
|         $eventHero1 = $this->createEventHero($event1, $heroUser1, 1); | ||||
|         $manager->persist($eventHero1); | ||||
| 
 | ||||
|         $eventHero2 = $this->createEventHero($event1, $heroUser2, 2); | ||||
|         $manager->persist($eventHero2); | ||||
| 
 | ||||
|         $manager->flush(); | ||||
|     } | ||||
| 
 | ||||
|     private function createEventHero(Event $event, Hero $hero, int $team) | ||||
|     { | ||||
|         return new EventHero($event, $hero, $team); | ||||
|     } | ||||
| 
 | ||||
|     public function getDependencies() | ||||
|     { | ||||
|         return array( | ||||
|             UserFixtures::class, | ||||
|             HeroFixtures::class, | ||||
|             EventFixtures::class | ||||
|         ); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1,128 @@ | ||||
| <?php | ||||
| namespace App\Entity; | ||||
| 
 | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| 
 | ||||
| class Event | ||||
| { | ||||
| 
 | ||||
|     const QUEST = 1; | ||||
| 
 | ||||
|     const TOURNAMENT = 2; | ||||
| 
 | ||||
|     const FREE_BATTLE = 3; | ||||
| 
 | ||||
|     const LEAGUE_MATCHDAY = 4; | ||||
| 
 | ||||
|     // Reserved value (was "wanted" battles) | ||||
|     const CLAN_BATTLE = 6; | ||||
| 
 | ||||
|     private ?int $id; | ||||
| 
 | ||||
|     private int $type = self::QUEST; | ||||
| 
 | ||||
|     private int $version = 1; | ||||
| 
 | ||||
|     private Collection $heroes; | ||||
| 
 | ||||
|     private Collection $battles; | ||||
| 
 | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->heroes = new ArrayCollection(); | ||||
|         $this->battles = new ArrayCollection(); | ||||
|     } | ||||
| 
 | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
|     } | ||||
| 
 | ||||
|     public function getType(): ?int | ||||
|     { | ||||
|         return $this->type; | ||||
|     } | ||||
| 
 | ||||
|     public function setType(int $type): self | ||||
|     { | ||||
|         $this->type = $type; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return Collection|EventHero[] | ||||
|      */ | ||||
|     public function getHeroes(): Collection | ||||
|     { | ||||
|         return $this->heroes; | ||||
|     } | ||||
| 
 | ||||
|     public function addHero(EventHero $hero): self | ||||
|     { | ||||
|         if (!$this->heroes->contains($hero)) { | ||||
|             $this->heroes[] = $hero; | ||||
|             $hero->setEvent($this); | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function removeHero(EventHero $hero): self | ||||
|     { | ||||
|         if ($this->heroes->contains($hero)) { | ||||
|             $this->heroes->removeElement($hero); | ||||
|             // set the owning side to null (unless already changed) | ||||
|             if ($hero->getEvent() === $this) { | ||||
|                 $hero->setEvent(null); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return Collection|EventBattle[] | ||||
|      */ | ||||
|     public function getBattles(): Collection | ||||
|     { | ||||
|         return $this->battles; | ||||
|     } | ||||
| 
 | ||||
|     public function addBattle(EventBattle $battle): self | ||||
|     { | ||||
|         if (!$this->battles->contains($battle)) { | ||||
|             $this->battles[] = $battle; | ||||
|             $battle->setEvent($this); | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function removeBattle(EventBattle $battle): self | ||||
|     { | ||||
|         if ($this->battles->contains($battle)) { | ||||
|             $this->battles->removeElement($battle); | ||||
|             // set the owning side to null (unless already changed) | ||||
|             if ($battle->getEvent() === $this) { | ||||
|                 $battle->setEvent(null); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function getVersion(): ?int | ||||
|     { | ||||
|         return $this->version; | ||||
|     } | ||||
| 
 | ||||
|     public function setVersion(int $version): self | ||||
|     { | ||||
|         $this->version = $version; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1,112 @@ | ||||
| <?php | ||||
| namespace App\Entity; | ||||
| 
 | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| 
 | ||||
| class EventBattle | ||||
| { | ||||
| 
 | ||||
|     private ?Event $event = null; | ||||
| 
 | ||||
|     private int $eid = 0; | ||||
| 
 | ||||
|     private Collection $heroes; | ||||
| 
 | ||||
|     private Collection $actions; | ||||
| 
 | ||||
|     private array $value = []; | ||||
| 
 | ||||
|     public function __construct(Event $event, int $eid) | ||||
|     { | ||||
|         $this->event = $event; | ||||
|         $this->eid = $eid; | ||||
|         $this->heroes = new ArrayCollection(); | ||||
|         $this->actions = new ArrayCollection(); | ||||
|     } | ||||
| 
 | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
|     } | ||||
| 
 | ||||
|     public function getEvent(): ?Event | ||||
|     { | ||||
|         return $this->event; | ||||
|     } | ||||
| 
 | ||||
|     public function setEvent(?Event $event): self | ||||
|     { | ||||
|         $this->event = $event; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function getHeroLhs(): ?EventHero | ||||
|     { | ||||
|         return $this->heroLhs; | ||||
|     } | ||||
| 
 | ||||
|     public function setHeroLhs(?EventHero $heroLhs): self | ||||
|     { | ||||
|         $this->heroLhs = $heroLhs; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function getHeroRhs(): ?EventHero | ||||
|     { | ||||
|         return $this->heroRhs; | ||||
|     } | ||||
| 
 | ||||
|     public function setHeroRhs(?EventHero $heroRhs): self | ||||
|     { | ||||
|         $this->heroRhs = $heroRhs; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return Collection|EventHero[] | ||||
|      */ | ||||
|     public function getHeroes(): Collection | ||||
|     { | ||||
|         return $this->heroes; | ||||
|     } | ||||
| 
 | ||||
|     public function addHero(EventHero $hero): self | ||||
|     { | ||||
|         if (!$this->heroes->contains($hero)) { | ||||
|             $this->heroes[] = $hero; | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function removeHero(EventHero $hero): self | ||||
|     { | ||||
|         if ($this->heroes->contains($hero)) { | ||||
|             $this->heroes->removeElement($hero); | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function getEid(): ?int | ||||
|     { | ||||
|         return $this->eid; | ||||
|     } | ||||
| 
 | ||||
|     public function getValue(): ?array | ||||
|     { | ||||
|         return $this->value; | ||||
|     } | ||||
| 
 | ||||
|     public function setValue(array $value): self | ||||
|     { | ||||
|         $this->value = $value; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1,55 @@ | ||||
| <?php | ||||
| namespace App\Entity; | ||||
| 
 | ||||
| class EventBattleActions | ||||
| { | ||||
|     private ?int $id; | ||||
| 
 | ||||
|     private int $timeInSeconds; | ||||
|      | ||||
|     private array $action; | ||||
|      | ||||
|     private ?EventBattle $battle; | ||||
| 
 | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
|     } | ||||
| 
 | ||||
|     public function getTimeInSeconds(): ?int | ||||
|     { | ||||
|         return $this->timeInSeconds; | ||||
|     } | ||||
| 
 | ||||
|     public function setTimeInSeconds(int $timeInSeconds): self | ||||
|     { | ||||
|         $this->timeInSeconds = $timeInSeconds; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function getAction(): ?array | ||||
|     { | ||||
|         return $this->action; | ||||
|     } | ||||
| 
 | ||||
|     public function setAction(array $action): self | ||||
|     { | ||||
|         $this->action = $action; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function getBattle(): ?EventBattle | ||||
|     { | ||||
|         return $this->battle; | ||||
|     } | ||||
| 
 | ||||
|     public function setBattle(?EventBattle $battle): self | ||||
|     { | ||||
|         $this->battle = $battle; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1,114 @@ | ||||
| <?php | ||||
| namespace App\Entity; | ||||
| 
 | ||||
| class EventHero | ||||
| { | ||||
| 
 | ||||
|     private int $eid = 0; | ||||
| 
 | ||||
|     private string $name; | ||||
| 
 | ||||
|     private int $team = 0; | ||||
| 
 | ||||
|     private Skillz $skills; | ||||
| 
 | ||||
|     private Hero $hero; | ||||
| 
 | ||||
|     private User $user; | ||||
| 
 | ||||
|     private Event $event; | ||||
| 
 | ||||
|     public function __construct(Event $event, Hero $hero, int $team) | ||||
|     { | ||||
|         $this->event = $event; | ||||
|         $this->eid = $hero->getId(); | ||||
|         $this->name = $hero->getName(); | ||||
|         $this->skills = $hero->getSkills(); | ||||
|         $this->team = $team; | ||||
|         $this->hero = $hero; | ||||
|         $this->user = $hero->getUser(); | ||||
|     } | ||||
| 
 | ||||
|     public function getSkills(): Skillz | ||||
|     { | ||||
|         return $this->skills; | ||||
|     } | ||||
| 
 | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
|     } | ||||
| 
 | ||||
|     public function getName(): ?string | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
| 
 | ||||
|     public function getUser(): ?User | ||||
|     { | ||||
|         return $this->user; | ||||
|     } | ||||
| 
 | ||||
|     public function getEvent(): ?Event | ||||
|     { | ||||
|         return $this->event; | ||||
|     } | ||||
| 
 | ||||
|     public function getTeam(): ?int | ||||
|     { | ||||
|         return $this->team; | ||||
|     } | ||||
| 
 | ||||
|     public function getHero(): ?Hero | ||||
|     { | ||||
|         return $this->hero; | ||||
|     } | ||||
| 
 | ||||
|     public function getEid(): ?int | ||||
|     { | ||||
|         return $this->eid; | ||||
|     } | ||||
| 
 | ||||
|     public function setSkills(Skillz $skills): self | ||||
|     { | ||||
|         $this->skills = $skills; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function setName(string $name): self | ||||
|     { | ||||
|         $this->name = $name; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function setTeam(int $team): self | ||||
|     { | ||||
|         $this->team = $team; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function setUser(?User $user): self | ||||
|     { | ||||
|         $this->user = $user; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function setHero(?Hero $hero): self | ||||
|     { | ||||
|         $this->hero = $hero; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     public function setEvent(?Event $event): self | ||||
|     { | ||||
|         $this->event = $event; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in New Issue