コード例 #1
0
 public function checkBattleshipName(Game $game, Battleship $battleship)
 {
     if ($battleship->getLength() == 5) {
         if ($this->countShipAvailable($game, 5) == 1) {
             return true;
         } else {
             return false;
         }
     } elseif ($battleship->getLength() == 3) {
         if ($this->countShipAvailable($game, 3) == 2) {
             return true;
         } else {
             return false;
         }
     } elseif ($battleship->getLength() == 2) {
         if ($this->countShipAvailable($game, 2) == 2) {
             return true;
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
コード例 #2
0
 /**
  * Creates a form to delete a Battleship entity.
  *
  * @param Battleship $battleship The Battleship entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Battleship $battleship)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('battleship_delete', array('id' => $battleship->getId())))->setMethod('DELETE')->getForm();
 }