title: Symfony - Object of class DateTime could not be converted to string
body: <p>i am having troubles with datetime attribute in my class.</p>
  
  <p>Next code is in my twig template.</p>
  
  <pre><code>&lt;div class="process-photo"&gt;&lt;img src="{{ photo.getPhotoUrl }}" /&gt;&lt;/div&gt;
  </code></pre>
  
  <p>This is the getPhotoUrl method</p>
  
  <pre><code> public function getPhotoUrl()
      {
          return '/web/uploads/photos/'.$this-&gt;getUserId().'/'.$this-&gt;getPhotoUploadDate().'/'.$this-&gt;getName();
      }
  </code></pre>
  
  <p>This is the getPhotoUploadDate method</p>
  
  <pre><code>public function getPhotoUploadDate() {
      return date('Y-m-d', strtotime($this-&gt;creationDate));
      }
  </code></pre>
  
  <p>I am getting next error - Warning: strtotime() expects parameter 1 to be string, object given</p>
  
  <p>If i try this way</p>
  
  <pre><code>public function getPhotoUrl()
      {
          return '/web/uploads/photos/'.$this-&gt;getUserId().'/'.$this-&gt;creationDate.'/'.$this-&gt;getName();
      }
  </code></pre>
  
  <p>I am getting next error - Catchable Fatal Error: Object of class DateTime could not be converted to string</p>
  
  <p>what i am doing wrong??</p>