I'm working on some PHP app where I'm using a Vehicle
model.
This model should contain some data and probably logic regarding the vehicle controls, emission controls and some regular services. Here is code:
class Vehicle extends Entity {
protected $name;
protected $registrationNumber;
protected $registrationCountry;
protected $seatsCapacity;
protected $obtainDate;
protected $color;
protected $comment;
protected $naviSerialNumber;
protected $fuelCardNumber;
protected $techicalStatus;
protected $transferStatus;
protected $ownership;
}
where $technicalStatus
should be a instance of such class:
class VehicleTechnicalStatus extends ValueObject {
protected $tachoValue;
protected $vehControlDate;
protected $vehControlValidDue;
protected $emissControlDate;
protected $emissControlValidDue;
protected $lastRegServiceTachoValue;
protected $lastRegServiceDate;
protected $serviceInterval;
}
Of course it will contain some logic regarding the vehicle control dates, services etc.
Is it correct to make such class a ValueObject
? It hasn't any identity but in Vehicle
it will be frequently changed (replaced, as its a ValueObject
and should be immutable).
Is it correct design? Or should I place all these properties and business logic methods directly to Vehicle
class?