-
-
Save kamil161g/d8b359a775e3e24996060f292c514ad6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; | |
use App\Entity\Material; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
class MessageGenerator extends AbstractController | |
{ | |
public function getMaterial() | |
{ | |
$carbon = $this->getDoctrine() | |
->getRepository(Material::class) | |
->findOneBy([ | |
'user' => $this->getUser(), | |
'category' => 'Carbon' | |
]); | |
$stone = $this->getDoctrine() | |
->getRepository(Material::class) | |
->findOneBy([ | |
'user' => $this->getUser(), | |
'category' => 'Stone' | |
]); | |
$wood = $this->getDoctrine() | |
->getRepository(Material::class) | |
->findOneBy([ | |
'user' => $this->getUser(), | |
'category' => 'Wood' | |
]); | |
$food = $this->getDoctrine() | |
->getRepository(Material::class) | |
->findOneBy([ | |
'user' => $this->getUser(), | |
'category' => 'Food' | |
]); | |
$gold = $this->getDoctrine() | |
->getRepository(Material::class) | |
->findOneBy([ | |
'user' => $this->getUser(), | |
'category' => 'Gold' | |
]); | |
return [ | |
'carbon' => $carbon, | |
'stone' => $stone, | |
'wood' => $wood, | |
'food' => $food, | |
'gold' => $gold, | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment