我的原则存储库代码不起作用,而我的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();
}
}发布于 2017-09-04 13:38:15
Server配置管理器-> Server网络配置->协议用于-> TCP/IP ->
我更改了以下内容
IpAll
TCP Dynamic Ports 49226
TCP Port至:
IpAll
TCP Dynamic Ports
TCP Port 1433不确定TCP动态端口是什么以及为什么配置它们。
发布于 2020-12-03 08:16:15
用于 Server 2019开发人员
默认安装:
The Fix
https://stackoverflow.com/questions/45613358
复制相似问题