Undo casting time types to Time object #189

This commit is contained in:
Nabeel Shahzad
2018-02-11 20:50:48 -06:00
parent 61af5fe226
commit 2f8a69b774
3 changed files with 13 additions and 13 deletions

View File

@@ -114,26 +114,26 @@ class Flight extends BaseModel
/** /**
* @return Time * @return Time
*/ */
public function getFlightTimeAttribute() /*public function getFlightTimeAttribute()
{ {
if (!array_key_exists('flight_time', $this->attributes)) { if (!array_key_exists('flight_time', $this->attributes)) {
return null; return null;
} }
return new Time($this->attributes['flight_time']); return new Time($this->attributes['flight_time']);
} }*/
/** /**
* @param $value * @param $value
*/ */
public function setFlightTimeAttribute($value) /*public function setFlightTimeAttribute($value)
{ {
if ($value instanceof Time) { if ($value instanceof Time) {
$this->attributes['flight_time'] = $value->getMinutes(); $this->attributes['flight_time'] = $value->getMinutes();
} else { } else {
$this->attributes['flight_time'] = $value; $this->attributes['flight_time'] = $value;
} }
} }*/
/** /**
* Relationship * Relationship

View File

@@ -141,26 +141,26 @@ class Pirep extends BaseModel
/** /**
* @return Time * @return Time
*/ */
public function getFlightTimeAttribute() /*public function getFlightTimeAttribute()
{ {
if (!array_key_exists('flight_time', $this->attributes)) { if (!array_key_exists('flight_time', $this->attributes)) {
return null; return null;
} }
return new Time($this->attributes['flight_time']); return new Time($this->attributes['flight_time']);
} }*/
/** /**
* @param $value * @param $value
*/ */
public function setFlightTimeAttribute($value) /*public function setFlightTimeAttribute($value)
{ {
if($value instanceof Time) { if($value instanceof Time) {
$this->attributes['flight_time'] = $value->getMinutes(); $this->attributes['flight_time'] = $value->getMinutes();
} else { } else {
$this->attributes['flight_time'] = $value; $this->attributes['flight_time'] = $value;
} }
} }*/
/** /**
* Return the planned_distance in a converter class * Return the planned_distance in a converter class
@@ -200,26 +200,26 @@ class Pirep extends BaseModel
/** /**
* @return Time * @return Time
*/ */
public function getPlannedFlightTimeAttribute() /*public function getPlannedFlightTimeAttribute()
{ {
if (!array_key_exists('planned_flight_time', $this->attributes)) { if (!array_key_exists('planned_flight_time', $this->attributes)) {
return null; return null;
} }
return new Time($this->attributes['planned_flight_time']); return new Time($this->attributes['planned_flight_time']);
} }*/
/** /**
* @param $value * @param $value
*/ */
public function setPlannedFlightTimeAttribute($value) /*public function setPlannedFlightTimeAttribute($value)
{ {
if ($value instanceof Time) { if ($value instanceof Time) {
$this->attributes['planned_flight_time'] = $value->getMinutes(); $this->attributes['planned_flight_time'] = $value->getMinutes();
} else { } else {
$this->attributes['planned_flight_time'] = $value; $this->attributes['planned_flight_time'] = $value;
} }
} }*/
/** /**
* Do some cleanup on the route * Do some cleanup on the route

View File

@@ -67,7 +67,7 @@ class PIREPTest extends TestCase
* Now set the PIREP state to ACCEPTED * Now set the PIREP state to ACCEPTED
*/ */
$new_pirep_count = $pirep->pilot->flights + 1; $new_pirep_count = $pirep->pilot->flights + 1;
$original_flight_time = $pirep->pilot->flight_time ; $original_flight_time = $pirep->pilot->flight_time;
$new_flight_time = $pirep->pilot->flight_time + $pirep->flight_time; $new_flight_time = $pirep->pilot->flight_time + $pirep->flight_time;
$this->pirepSvc->changeState($pirep, PirepState::ACCEPTED); $this->pirepSvc->changeState($pirep, PirepState::ACCEPTED);