My doctrine repository code doesn't work, while I am able to access the database and read table data normally.
I get this stacktrace:
EntityManager->getRepository('AppBundle:Person') in src\AppBundle\Controller\PersonViewController.php (line 18)
public function indexAction(Request $request) {
$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository('AppBundle:Person');
$persons = $repo->findAll();
dump($persons);
The person entity model:
Person.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Person
* @Package AppBundle/Entity
*
* @ORM\Entity(repositoryClass="AppBundle\Repository\PersonRepository")
* @ORM\Table(name="[Person]")
*/
class Person {
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=4)
*/
protected $type;
}
In case this is necessary as well, the repo code:
PersonRepository.php
<?php
namespace AppBundle\Repository;
use /** @noinspection PhpUndefinedClassInspection */
Doctrine\ORM\EntityRepository;
class PersonRepository extends EntityRepository {
public function create() {
$entity = new Person();
$entity->type('WM_B');
$this->_em->persist($entity);
$this->_em->flush();
}
}
Sql Server Configuration Manager -> Sql Server Network Configuration -> Protocols For -> TCP/IP ->
I changed the following
IpAll
TCP Dynamic Ports 49226
TCP Port
To:
IpAll
TCP Dynamic Ports
TCP Port 1433
Not sure what TCP Dynamic Ports are and why they were configured.