我的学说存储库代码不起作用,而我am能够正常访问数据库、读取表数据。
我得到这个堆栈跟踪:
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);
人实体模型:
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;
}
如果这也是必要的,存储库代码:
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 配置管理器 -> Sql Server 网络配置 -> 协议 -> TCP/IP ->
我改变了以下内容
IpAll
TCP Dynamic Ports 49226
TCP Port
To:
IpAll
TCP Dynamic Ports
TCP Port 1433
不确定 TCP 动态端口是什么以及为什么配置它们。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)