I have a problem with doctrine2 in a symfony2 application with a postgres database.
I get an error:
SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema "main" does not exist
The problem is that my circuit is not Main. When I rename it, a similar situation holds for a table relation:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "main.brand_brandid_seq" does not exist
The problem is case sensitivity, and I think this may be due to quoting or some configuration of the doctrine.
Entity:
namespace MyB\Entity; class Brand { private $brandid; private $brandname; public function setName($name) { $this->brandname = $name; } }
Scheme:
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 );
Controller:
$reseller = new \MyB\Entity\Brand(); $reseller->setName('Sasa'); $em = $this->get('doctrine.orm.entity_manager'); $em->persist($reseller); $em->flush();
Any idea?
source share