public function handle(Command $command) { $reservation = Reservation::take($command->reservationId, $command->restaurantId, $command->customerId, $command->numPeople, $command->dateTime); $this->repository->save($reservation); }
public static function take(ReservationId $reservationId, RestaurantId $restaurantId, CustomerId $customerId, $numPeople, \DateTime $dateTime) { $reservation = new Reservation(); $reservation->recordThat(new ReservationWasTaken(['reservationId' => $reservationId, 'restaurantId' => $restaurantId, 'customerId' => $customerId, 'numPeople' => $numPeople, 'dateTime' => $dateTime])); return $reservation; }