public function destroy(Request $request)
 {
     $partId = PartId::fromString($request->get('partId'));
     $command = new RemovePartCommand($partId);
     $this->commandBus->dispatch($command);
     return Redirect::route('parts.index')->with('success', 'Part successfully deleted.');
 }
 /**
  * @param  array $data
  * @return mixed The object instance
  */
 public static function deserialize(array $data)
 {
     $partId = PartId::fromString($data['partId']);
     return new self($partId, $data['manufacturerId'], $data['manufacturerName']);
 }
 /**
  * @param array $data
  * @return mixed The object instance
  */
 public static function deserialize(array $data)
 {
     $partId = PartId::fromString($data['partId']);
     return new self($partId);
 }
 /**
  * @test
  */
 public function it_does_not_rename_manufacturer_to_the_same_name()
 {
     $id = PartId::generate();
     $this->scenario->withAggregateId($id)->given([new PartWasManufacturedEvent($id, 'acme', 'Acme, Inc'), new PartWasManufacturedEvent($id, 'acme', 'Acme, Inc.')])->when(new RenameManufacturerForPartCommand($id, 'Acme, Inc.'))->then([]);
 }
 /** @test */
 public function should_return_id_as_string()
 {
     $id = PartId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', $id->toString());
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', (string) $id);
 }
 /**
  * @return \Modules\Core\Domain\Identifier
  */
 private function makeNewPartId()
 {
     $id = PartId::generate();
     return PartId::fromString($id);
 }