PHP - Deliberate loose == check and assigning to if statement if ($v-&gt;getMedical()) {
    $visitorHasMedical = $v-&gt;getMedical()-&gt;getMedCon() == true; // $visitorHasMedical will be false if "falsey" i.e. empty string or NULL
} else {
    $visitorHasMedical = false;
}


Where getMedical() is a OneToOne Doctrine relationship that might not exist.

Does this snippet read OK? Firstly, I'm deliberately doing a loose == check as this could be NULL or empty string.

Secondly, is assigning $visitorHasMedical to what is essential an if statement OK?
Quite so. Except for the trailing comment getting beyond edge. But it can be written in much simpler way anyway.

$medical = $v-&gt;getMedical();
$visitorHasMedical = ($medical &amp;&amp; $medical-&gt;getMedCon());