1
最近我將一列數據庫表更改爲另一個。執行遷移後的學說時,我做的事:如果我Symfony從路由中獲取對象不起作用
"SQLSTATE [42S22]: Column not found: 1054 Unknown column 'p.price_discount' in 'field list'"
:
ProductTable::getInstance()->find(1);
一切正常
$this->getRoute()->getObject()
我返回了一個錯誤!
我清空緩存完成1000次並構建 - 儘可能多。
我的schema.yml:
Product:
tableName: products
actAs:
Timestampable:
created:
name: created_at
type: timestamp
form: d-m-Y H:i:s
I18n:
fields: [title, subtitle, description, datasheet, returns_shippings, inspiration, use_care]
actAs:
Sluggable: { fields: [title], uniqueBy: [lang, title] }
columns:
id:
type: integer(4)
primary: true
notnull: true
autoincrement: true
ref:
type: string(45)
unique: true
notnull: true
active:
type: boolean
notnull: true
default: 0
new:
type: boolean
notnull: true
default: 0
title:
type: string(45)
subtitle:
type: string(45)
inspiration: clob
use_care: clob
brand:
type: string(45)
description:
type: clob(65535)
datasheet:
type: clob(65535)
returns_shippings:
type: clob(65535)
price:
type: float
notnull: true
default: 0
votes:
type: integer
notnull: true
default: 0
weight:
type: float
notnull: true
default: 0
iva_id:
type: integer(4)
notnull: true
relations:
Iva:
class: Iva
local: iva_id
foreign: id
foreignAlias: Products
Styles:
foreignAlias: Products
class: Style
refClass: StyleProduct
onDelete: CASCADE
Categories:
foreignAlias: Products
class: Category
refClass: CategoryProduct
onDelete: CASCADE
RelatedProducts:
foreignAlias: Products
class: Product
refClass: RelatedProduct
local: product_id
foreign: product_id1
onDelete: CASCADE
會發生什麼?
你重建了你的模型嗎? './symfony doctrine:build --model' – j0k
我已經完成並構建 - 所有:-( – Mauro
)您可以用'Product'表向我們展示您的schema.yml的一部分 – j0k