php - Doctrine getRepository() is actively refused by SQL Server -
i able access database
though via pdo
queries. i'm new both of these things i'm new php
, don't know preferred use, assume entity manager easier. goal have simple web
application can show data sql-server
database
.
system
windows
8php
7sql-server
pdo
4symfony
3
error message:
sqlstate[08001]: [microsoft][odbc driver 13 sql server]tcp provider: no connection made because target machine actively refused it.
my code:
$repo = $em->getrepository('mybundle:myobject');
myobject.php
<?php // src/mybundle/entity/myobject.php namespace mybundle\entity; use doctrine\orm\mapping orm; /** * myobject * * @orm\table(name="myobject") * @orm\entity(repositoryclass="mybundle\repository\myobjectrepository") */ class myobject { /** * @orm\column(type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @orm\column(type="string", length=4) */ private $type; }
myobjectrepository.php
<?php /** * created phpstorm. * user: rsluimers * date: 28-7-2017 * time: 10:55 */ namespace mybundle\repository; use doctrine\orm\entityrepository; class myobjectrepository extends entityrepository { public function create() { $entity = new myobject(); $entity->type('wm_b'); $this->_em->persist($entity); $this->_em->flush(); } }
check out parameters file if correct there:
database_host: localhost database_port: port database_name: database database_user: user database_password: pass
Comments
Post a Comment