1
doctrine 1.2와 함께 symfony 1.4에서 이상한 오류가 발생했습니다. 내 스키마가 정상적인 것 같습니다. 그러나 doctrine:build --all --no-confirmation --and-load
작업을 실행할 때마다 오류 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'default_edition_id' cannot be null
이 출력됩니다. default_edition_id 필드에 대해 notnull을 false로 설정하면 실제로 null이됩니다. 아무도 내가 놓칠지도 모르는 것에 대해 나를 도울 수 있습니까?무결성 제약 조건 위반 : 1048 열이 null 오류가 될 수 없음
Chapter:
actAs:
Timestampable: ~
Versionable:
versionColumn: version
className: %CLASS%Version
SoftDelete: ~
columns:
name: string
chapter_number: { type: integer, notnull: true }
series_id: { type: integer, notnull: true }
default_edition_id: { type: integer, notnull: true }
disabled:
type: enum
values: [1, 0]
default: 0
notnull: true
relations:
DefaultEdition:
local: default_edition_id
class: Edition
foreign: id
foreignAlias: DefaultChapter
foreignType: one
type: one
# onDelete: CASCADE
Series:
local: series_id
foreign: id
onDelete: CASCADE
Editions:
type: many
class: Edition
local: id
foreign: chapter_id
내 에디션 스키마 (edition.yml) :
Edition:
actAs:
Timestampable: ~
Sluggable:
fields: [name]
Versionable:
versionColumn: version
className: %CLASS%Version
SoftDelete: ~
columns:
name: string
completed_reads: { type: integer, notnull: true, default: 0}
views: { type: integer, notnull: true, default: 0 }
language_id: { type: integer, notnull: true }
chapter_id: { type: integer, notnull: true }
disabled:
type: enum
values: [1, 0]
default: 0
notnull: true
relations:
Pages:
type: many
class: Page
local: id
foreign: edition_id
Language:
local: language_id
foreign: id
type: one
onDelete: CASCADE
Chapter:
local: chapter_id
foreign: id
onDelete: CASCADE
설비 :
Chapter:
bakuman_chapter:
Series: bakuman
chapter_number: 86
DefaultEdition: edition_1
bakuman_chapter2:
Series: bakuman
DefaultEdition: edition_2
chapter_number: 90
Edition:
edition_1:
name: edition 1
Chapter: bakuman_chapter
ScanlationGroup: [group_1, group_2, group_3]
Language: english
edition_2:
name: edition 2
Chapter: bakuman_chapter2
ScanlationGroup: [group_4]
Language: japanese
edition_2_2:
name: edition 2_2
Chapter: bakuman_chapter2
ScanlationGroup: [group_4, group_2]
Language: english
내 상황에 조금 비춰 줄 장비를 추가했습니다. 'SQLSTATE [23000] : Integrity constraint violation : 1048 컬럼'default_edition_id '가 null 일 수 없다'라는 오류를 피하기 위해 Notnull을 false로 설정하면 새로 추가 할 때마다 DefaultEdition 컬럼이 NULL로 설정됩니다. 나는 싫어. –
@ 대쉬 : 알았어, 이렇게 더 이해할 수있어. 현재이 튜토리얼을 읽었습니다 : http://www.symfony-project.org/jobeet/1_4/Doctrine/en/03 참고로 조명기 파일에서 참조되는 카테고리는 참조 작업 전에 정의됩니다. 이 문제가 중요한지는 모르겠지만 조명기 파일의 챕터 및 에디션 섹션을 뒤집어 볼 수도 있습니다 ... – greg0ire
아니요, 챕터 및 에디션 설비를 어떤 순서로 배치해도 상관 없습니다. –