public function getType($side) { if ($this->{$side . '_type_id'}) { return $this->{$side . '_type'}->name; } else { return $this->{$side . '_type_other'}; } }