/** * abre la mesa y setea el mozo * @param Mozo $mozo */ public function abrir($mozo) { //$this->getPedido()->vaciar(); if (!$this->getEstado()->equals(EstadoMesa::abierta())) { $this->setFechaAbierta(DateUtil::formatAsTimeStamp(time())); $this->setearMozoYEstado($mozo, EstadoMesa::abierta()); $pedido = new Pedido(); //$pedido->setNumero(21);//clase aca //$pedido->setFecha($this->getFechaAbierta()); $restaurant = Restaurant::getInstance()->agregarPedido($pedido); $pedido->save(); $this->setPedido($pedido); return true; } return false; }
public function construct() { if ($this->isNew()) { try { parent::construct(); $this->setEstado(EstadoPedido::pendiente()); $this->setFecha(DateUtil::formatAsTimeStamp(time())); $this->setNumero(Restaurant::getInstance()->pedidos()->count() + 1); } catch (Exception $e) { /** * This try/catch clause is necessary to prevent the Doctrine data loader command from * failing. * */ } } }