title: How to dynamically set an object property value?
body: <p>I have a customer object data:</p>
  <pre><code>App\Entity\Customer {#661
      -id: 100003
      -manufacturer: &quot;TEST A&quot;
      -description: &quot;This is a description&quot;
      ...
      ...
      ...
  }
  </code></pre>
  <p>From an array which consist of column name I need to reset the object value.</p>
  <p>From the array, with a loop:</p>
  <pre><code>foreach ($user as $key =&gt; $value) {
      if ($key === 'manufacturer') {
          $customer-&gt;setManufacturer($value);
      }
  
      if ($key === 'description') {
          $customer-&gt;setDescription($value);
      }
     ... and so on...
  }
  </code></pre>
  <p>Is it possible to dynamically set the object without making multiple if condition.</p>
  <p>I have tried following:</p>
  <pre><code>$label = 'set' . ucfirst($key);
  $tyre-&gt;{$label} = $value;
  </code></pre>
  <p>But it is not updating the object instead adding</p>
  <p><a href="https://i.stack.imgur.com/ADoE2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ADoE2.png" alt="Appended label" /></a></p>