{"id":72,"date":"2017-01-07T17:39:32","date_gmt":"2017-01-07T19:39:32","guid":{"rendered":"http:\/\/hackerzone.com.br\/blog\/?p=72"},"modified":"2022-08-13T00:21:03","modified_gmt":"2022-08-13T03:21:03","slug":"configuracao-de-conexao-doctrine-no-zendframework-3","status":"publish","type":"post","link":"http:\/\/hackerzone.com.br\/blog\/configuracao-de-conexao-doctrine-no-zendframework-3\/","title":{"rendered":"Configura\u00e7\u00e3o de Conex\u00e3o Doctrine no ZendFramework 3"},"content":{"rendered":"<p>Esta \u00e9 uma configura\u00e7\u00e3o padr\u00e3o que costumo utilizar em meus projetos para <strong>conex\u00e3o do Doctrine com banco de dados MySQL<\/strong>, segue o exemplo caso deseja realizar a mesma configura\u00e7\u00e3o.<\/p>\n<p>Dentro do arquivo &#8220;projeto\/config\/autoload\/local.php&#8221; tamb\u00e9m pode ser no arquivo global (geralmente utiliza-se arquivo local pra conex\u00f5es locais e global para globais, mas quase sempre representam a mesma coisa)<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nreturn [\r\n    'doctrine' =&gt; array(\r\n        'connection' =&gt; array(\r\n            \/\/ default connection name\r\n            'orm_default' =&gt; array(\r\n                'driverClass' =&gt; 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver',\r\n                'params' =&gt; array(\r\n                    'host'     =&gt; 'localhost',\r\n                    'port'     =&gt; '3306',\r\n                    'user'     =&gt; 'usuario_banco',\r\n                    'password' =&gt; 'usuario_senha',\r\n                    'dbname'   =&gt; 'nome_banco',\r\n                    'driverOptions' =&gt; array(\r\n                        PDO::MYSQL_ATTR_INIT_COMMAND=&gt;&quot;SET NAMES 'UTF8'&quot;,\r\n                    ),\r\n                ),\r\n            ),\r\n        ),\r\n    ),\r\n];\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Esta \u00e9 uma configura\u00e7\u00e3o padr\u00e3o que costumo utilizar em meus projetos para conex\u00e3o do Doctrine com banco de dados MySQL, segue o exemplo caso deseja realizar a mesma configura\u00e7\u00e3o. Dentro do arquivo &#8220;projeto\/config\/autoload\/local.php&#8221; tamb\u00e9m pode ser no arquivo global (geralmente utiliza-se arquivo local pra conex\u00f5es locais e global para globais, mas quase sempre representam a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":459,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,12,13],"tags":[16,17,15,18,19],"class_list":["post-72","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-doctrine","category-php","category-zend-framework-3","tag-doctrine","tag-mysql","tag-php","tag-zend-framework-3","tag-zf3","cat-14-id","cat-12-id","cat-13-id","has_thumb"],"_links":{"self":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":3,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":75,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/72\/revisions\/75"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media\/459"}],"wp:attachment":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}