title: Why one MySQL database accepts DateTime and other not?
body: <p><strong>Dev and remote system</strong></p>
  
  <p>I have a local dev system and deployment system remotely with configuration:</p>
  
  <ul>
  <li>Php Core: Symfony 4.2</li>
  <li>Mysql: 5.7.26 Innodb</li>
  <li>Linux: 18.x</li>
  <li>Doctrine: 2.x</li>
  </ul>
  
  <p><strong>Problem description</strong></p>
  
  <p>The problem is now that I have <strong>DataFixtures</strong> (Symfony demo data generators) which I run to fill out my databse. When I run command to fill the database then for some unknow reason <strong>DateTime</strong> variables are being saved into database without any single problem on <strong>Dev</strong> environment, but when I run the same command on remote server (<strong>prod</strong>) I keep getting:</p>
  
  <p><code>PDO Error, Object of class DateTime could not be converted to string</code>.</p>
  
  <p>I cannot figure out where are the database differences, why one database accepts DateTime, and the other won't.</p>
  
  <p><strong>Already tested/compared</strong></p>
  
  <p>I've already tried to search for solution for couple of hours:</p>
  
  <ul>
  <li>was comparing the database configuration variables</li>
  <li>searched for some configurations which maybe turn some convertion of DateTime to string automatically on server side.</li>
  </ul>
  
  <p>Made sure that the source code/config/pages are the same:</p>
  
  <ul>
  <li>The database structure is 100% the same,</li>
  <li>composer packages are the same, </li>
  <li>entire instance is the same i just copied everything 1:1 with hidden config files as well.</li>
  <li>I also tried to set 
  <code>@ORM\Column(type="datetime", length=255, nullable=true)</code>.</li>
  </ul>
  
  <p><strong>Summary</strong></p>
  
  <p>The biggest issue is that answers like:</p>
  
  <p><em>"You need to insert string value $date->format('y-m-d');"</em> </p>
  
  <p>is not helping because if I do that then on my dev system I get errors that DateTime or null is expected and I tried to insert string.</p>
  
  <p>Either there is some strange mysql configuration missing or some apache package - I just can't find it.</p>
  
  <p>Let me know if I can provide You some data.</p>
  
  <p><strong>Example of column definition in entity</strong></p>
  
  <pre><code>    /**
       * @ORM\Column(type="date", length=255, nullable=true)
       */
      private $deadline;
  </code></pre>