1. EntityͬͯԿʁ
1-1. MVC
1-2. TableͱEntity
1-3. Entityͷొγʔϯ
1. What is Entity?
Slide 6
Slide 6 text
1. What is Entity?
V C M
MVC Model View Controller
View Controller Model
Slide 7
Slide 7 text
1. What is Entity?
MVC Model View Controller
V C M
View Controller Model
Slide 8
Slide 8 text
1. What is Entity?
V C M
CakePHP2
MVC of CakePHP2
Slide 9
Slide 9 text
1. What is Entity?
V C T
CakePHP3
E
Table
Entity
MVC of CakePHP3
Slide 10
Slide 10 text
T
1. What is Entity?
E
ɾ$BLF1)1ͷʮ.PEFMʯʹׂ͍ۙ
Table
Entity
ɾ%#ͷʮ5BCMFʯͷΞΫηε
ɾσʔλϨίʔυ
TableͱEntity
ɾϨίʔυ͝ͱʹΠϯελϯεԽ
ɾྻͰͳ͍ͷͰ֦ு͕༰қ
ɾ7BMJEBUJPO
Associationͷઃఆ
Slide 11
Slide 11 text
1. What is Entity?
E
Entityͷొγʔϯ
E
E
E
E
E
E
E
E
E
E
E
E
E
E
E
E E
E
E
E
E
E
E
E
E
Ma
Request Data
DB
ResultSet
Marshaller
beforeMarshal() Validation()
SELECT
SELECT
Slide 12
Slide 12 text
1. EntityͬͯԿʁ
EntityCakePHP2Ͱ͍͏ModelͷҰ෦
CakePHP2ͷModelTableͱEntityʹ͔Εͨ
find(SELECT)ͨ͠ͱ͖ + POST͞Εͨͱ͖
POST͞ΕͨσʔλΛEntityԽ͢Δͱ͖ʹόϦσʔγϣϯ͕ಈ͘
( CakePHP2ͱಉ༷ʹอଘ࣌ʹόϦσʔγϣϯಈ͘ )
1. What is Entity?
Slide 13
Slide 13 text
2. Entityศརͩͬͨʁ
2. Is Entity useful ?
Slide 14
Slide 14 text
2. Is Entity useful ?
2. Entityศརͩͬͨʁ
2-1. ॲཧ͕؆ܿʹͳͬͨ
ɾFat Controller -> Fat Model -> ?
2-2. GetterͱSetter
ɾ.7$ͷͲ͔͜ΒͰΞΫηεՄೳ
Slide 15
Slide 15 text
V C M
Fat Controller
ॳ৺ऀͷ͜Ζ
2. Is Entity useful ?
Slide 16
Slide 16 text
V C M
Fat Model
খ׳Ε͖ͯͨ͜Ζ
2. Is Entity useful ?
Slide 17
Slide 17 text
V C M
T E
Finder
Validation
Association
Save
2. Is Entity useful ?
͜ͷ͝Ζ
μΠΤοτ
Slide 18
Slide 18 text
V
C M
T E
μΠΤοτ
Finder
Validation
Association
Save
2. Is Entity useful ?
͜ͷ͝Ζ
Slide 19
Slide 19 text
2. Is Entity useful ?
V
C
M
E
CakePHP3
E
E
E
function hoge()
V
C
M
CakePHP2
V
C
M array( )
array( )
array( )
function hoge()
Ͳ͔͜ΒͰΞΫηε
Slide 20
Slide 20 text
2. Is Entity useful ?
V
C
M
E
Ͳ͔͜ΒͰΞΫηε
CakePHP3
E
E
E
function hoge()
V
C
M
CakePHP2
V
C
M array( )
array( )
array( )
function hoge()
hoge()
hoge()
hoge()
Slide 21
Slide 21 text
2. Is Entity useful ?
V
C
M
E
CakePHP3
E
E
E
function hoge()
V
C
M
CakePHP2
V
C
M array( )
array( )
array( )
function hoge()
hoge()
hoge()
Ͳ͔͜ΒͰΞΫηε
3-1.อଘ࣌ʹ(FUUFS͕Δ
ঢ়گ) ֹۚΛද͍ࣔͨ͠ʂJOQVUͷΧϯϚ۠Γʹ͍ͨ͠ʂ
1000
int text 1,000
text 1,000 1000
int
1000
int text 1,000
1000
int text1,000
text 1,000 1000
int
Getter
Setter
Getter
Setter
Getter
ཧ
ݱ࣮
SQL Error
※ ΧϥϜ໊Ͱ(FUUFSΛ࡞͢Δ࣌ҙ
Slide 28
Slide 28 text
3-2.ෳճ4FUUFS͕Δ
ঢ়گ) ϚϧνεςοϓͷϑΥʔϜΛ࡞Γ͍ͨ
Request Data
Ma
Form1
Form2
_setPassword()
E
adminadmin dsfknadfgnadflgkng
Request Data
Ma
_setPassword()
E
dsfknadfgnadflgkng 32ekwnesihwenfansrueaf
͋Εʁ
※EntityͷઃఆΛมߋ͢Ε͍͍͕ɺ
ɹɹ Marsherӽ͠ͰઃఆΛมߋͰ͖ͳ͍