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

View File

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