Exemplo n.º 1
0
 /**
  * Construct
  *
  * @param TrackingId $aTrackingId
  * @param RouteSpecification $aRouteSpecification
  */
 public function __construct(TrackingId $aTrackingId, RouteSpecification $aRouteSpecification)
 {
     $this->trackingId = $aTrackingId;
     //Construct is only called when the Cargo is initially created.
     //Doctrine do not call __construct when it recreates a persisted entity.
     //Therefor we can assign the origin here.
     //It will be always the same for that specific Cargo even if the RouteSpecification changes.
     $this->origin = $aRouteSpecification->origin();
     $this->routeSpecification = $aRouteSpecification;
 }
 /**
  * @param RouteSpecification $other
  * @return bool
  */
 public function sameValueAs(RouteSpecification $other)
 {
     if ($this->origin() !== $other->origin()) {
         return false;
     }
     if ($this->destination() !== $other->destination()) {
         return false;
     }
     return true;
 }