我在带有 postgres 数据库的 symfony2 应用程序中的教义2 有问题。
我得到错误:
SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema "main" does not exist
问题是我的架构是主要的而不是主要的。当我重命名它时,表关系发生了类似的事情:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "main.brand_brandid_seq" does not exist
问题是区分大小写,我想这可能与引用或某些学说配置有关。
实体:
namespace MyB\Entity;
/**
* MyB\Entity\Brand
*
* @orm:Table(name="Main.Brand")
* @orm:Entity
*/
class Brand
{
/**
* @var integer $brandid
*
* @orm:Column(name="BrandId", type="integer", nullable=false)
* @orm:Id
* @orm:GeneratedValue(strategy="SEQUENCE")
* @orm:SequenceGenerator(sequenceName="Main.Brand_BrandId_seq", allocationSize="1", initialValue="1")
*/
private $brandid;
/**
* @var string $brandname
*
* @orm:Column(name="BrandName", type="string", length=32, nullable=false)
*/
private $brandname;
/**
* Set name.
*
* @param string $name
*/
public function setName($name) {
$this->brandname = $name;
}
}
架构:
SET search_path = "Main", pg_catalog;
CREATE SEQUENCE "Brand_BrandId_seq"
START WITH 2
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE "Brand" (
"BrandId" integer DEFAULT nextval('"Brand_BrandId_seq"'::regclass) NOT NULL,
"BrandName" character varying(32) NOT NULL
);
控制器:
$reseller = new \MyB\Entity\Brand();
$reseller->setName('Sasa');
$em = $this->get('doctrine.orm.entity_manager');
$em->persist($reseller);
$em->flush();
任何想法?