Private
Public Access
1
0
This commit is contained in:
2016-11-01 13:20:14 +01:00
parent a6fc7fc396
commit 31e3097da3
2 changed files with 14 additions and 17 deletions

View File

@@ -13,10 +13,8 @@ use Gos\Bundle\WebSocketBundle\Router\WampRequest;
class MineseekerRpc implements RpcInterface class MineseekerRpc implements RpcInterface
{ {
/** /** @var EntityManager */
* @var EntityManager protected $em;
*/
protected $entityManager;
protected $grid; protected $grid;
@@ -26,7 +24,7 @@ class MineseekerRpc implements RpcInterface
*/ */
public function __construct(EntityManager $entityManager) public function __construct(EntityManager $entityManager)
{ {
$this->entityManager = $entityManager; $this->em = $entityManager;
} }
/** /**
@@ -69,9 +67,9 @@ class MineseekerRpc implements RpcInterface
{ {
$getsee = array(); $getsee = array();
$this->entityManager->clear(); $this->em->clear();
$grid = $this->entityManager $grid = $this->em
->getRepository('MineSeekerBundle:PlayedGame') ->getRepository('MineSeekerBundle:PlayedGame')
->findOneByGameAssoc($gameAssoc) ->findOneByGameAssoc($gameAssoc)
->getGrid(); ->getGrid();
@@ -108,24 +106,24 @@ class MineseekerRpc implements RpcInterface
/** Save Col */ /** Save Col */
$gridCol->setGridCol($gridRow); $gridCol->setGridCol($gridRow);
$this->entityManager->persist($gridCol); $this->em->persist($gridCol);
} }
/** Save Row */ /** Save Row */
$gridRow->setGrid($grid); $gridRow->setGrid($grid);
$this->entityManager->persist($gridRow); $this->em->persist($gridRow);
} }
/** Save Grid */ /** Save Grid */
$grid->setPlayedGame($playedGame); $grid->setPlayedGame($playedGame);
$this->entityManager->persist($grid); $this->em->persist($grid);
/** Save PlayedGame */ /** Save PlayedGame */
$playedGame->setGameAssoc($data[1]); $playedGame->setGameAssoc($data[1]);
$playedGame->setGrid($grid); $playedGame->setGrid($grid);
$this->entityManager->persist($playedGame); $this->em->persist($playedGame);
$this->entityManager->flush(); $this->em->flush();
return true; return true;
} }

View File

@@ -6,7 +6,6 @@ use Doctrine\ORM\EntityManager;
use Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface; use Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface;
use Gos\Bundle\WebSocketBundle\Topic\TopicInterface; use Gos\Bundle\WebSocketBundle\Topic\TopicInterface;
use Gos\Bundle\WebSocketBundle\Router\WampRequest; use Gos\Bundle\WebSocketBundle\Router\WampRequest;
use Guzzle\Http\Message\Request;
use Mine\SeekerBundle\Entity\Gamer; use Mine\SeekerBundle\Entity\Gamer;
use Mine\SeekerBundle\Entity\Step; use Mine\SeekerBundle\Entity\Step;
use Ratchet\ConnectionInterface; use Ratchet\ConnectionInterface;
@@ -189,10 +188,10 @@ class MineseekerTopic implements TopicInterface
$this->em->flush(); $this->em->flush();
return array( return array(
'red' => $playedGame->getRed() !== null ? $playedGame->getRed()->getUsername() : '', 'red' => null !== $playedGame->getRed() ? $playedGame->getRed()->getUsername() : '',
'blue' => $playedGame->getBlue() !== null ? $playedGame->getBlue()->getUsername() : '', 'blue' => null !== $playedGame->getBlue() ? $playedGame->getBlue()->getUsername() : '',
'redAnon' => $playedGame->getRedAnon() !== null ? $playedGame->getRedAnon()->getUserName() : '', 'redAnon' => null !== $playedGame->getRedAnon() ? $playedGame->getRedAnon()->getUserName() : '',
'blueAnon' => $playedGame->getBlueAnon() !== null ? $playedGame->getBlueAnon()->getUserName() : '' 'blueAnon' => null !== $playedGame->getBlueAnon() ? $playedGame->getBlueAnon()->getUserName() : ''
); );
} }
} }