Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CakePHP3レポート
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Junkins
May 26, 2016
Technology
960
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CakePHP3レポート
PHPカンファレンス福岡2016での登壇資料
Junkins
May 26, 2016
More Decks by Junkins
See All by Junkins
FusicTechLive1.5 AWSを活かした基幹システムインフラ構成の紹介
junkins
0
74
マルチ〇〇(リージョン、アカウント)の サービスをまとめてみた!
junkins
0
310
[Fukuoka.php Vol.16]LT CakePHP3を使ってみた:Migration Phinxの話
junkins
0
840
Other Decks in Technology
See All in Technology
手塩にかけりゃいいってもんじゃない
ming_ayami
0
560
MCP Appsを作ってみよう
iwamot
PRO
4
610
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
570
Android の公式 Skill / Android skills
yanzm
0
140
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
2
640
2026TECHFRESH畢業分享會 - 原生還是跨平台? App 開發踩坑實錄
line_developers_tw
PRO
0
980
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
960
SONiCのLinuxベースを活かしたZabbix監視
sonic
0
140
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
150
Disciplined Vibes: Scaling AI-Assisted Engineering
sheharyar
0
140
「エンジニア進化論」2028年の開発完全自動化、エンジニアはどう進化するか
cyberagentdevelopers
PRO
6
5.1k
Socrates × Looker 〜セマンティックレイヤーで進化するデータ分析エージェント〜
hanon52_
3
2.3k
Featured
See All Featured
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
160
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Visualization
eitanlees
152
17k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Paper Plane
katiecoart
PRO
1
51k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Transcript
CakePHP3Ϩϙʔτ 2016/05/21 PHPΧϯϑΝϨϯεԬ ҏ౻ ५थ
Introduction ҏ౻ ५थ Junkins_110 Junkins 1.3 2.ʙ 3.ʙ
Agenda CakePHP3 Ϩϙʔτ ࣮ࡍʹҊ݅Ͱ࠾༻ͨ͠ॴײ (ྑ͔ͬͨͱ͜Ζɺѱ͔ͬͨͱ͜Ζ) Model ( TableɺEntity ) 1.
EntityͬͯԿʁ 2. Entityศརͩͬͨʁ 3. EntityͰϋϚͬͨͱ͜Ζ͋ͬͨʁ ࠓ·Ͱ$BLF1)1Λ͍ͬͯͯɺ͜Ε͔Β$BLF1)1Λ͏ํ͚ CakePHP2ͱͷൺֱ͕ͪΐͪ͜ΐ͜ɻɻɻɻ
1. EntityͬͯԿʁ 1. What is Entity?
1. EntityͬͯԿʁ 1-1. MVC 1-2. TableͱEntity 1-3. Entityͷొγʔϯ 1. What
is Entity?
1. What is Entity? V C M MVC Model View
Controller View Controller Model
1. What is Entity? MVC Model View Controller V C
M View Controller Model
1. What is Entity? V C M CakePHP2 MVC of
CakePHP2
1. What is Entity? V C T CakePHP3 E Table
Entity MVC of CakePHP3
T 1. What is Entity? E ɾ$BLF1)1ͷʮ.PEFMʯʹׂ͍ۙ Table Entity ɾ%#ͷʮ5BCMFʯͷΞΫηε
ɾσʔλϨίʔυ TableͱEntity ɾϨίʔυ͝ͱʹΠϯελϯεԽ ɾྻͰͳ͍ͷͰ֦ு͕༰қ ɾ7BMJEBUJPO Associationͷઃఆ
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
1. EntityͬͯԿʁ EntityCakePHP2Ͱ͍͏ModelͷҰ෦ CakePHP2ͷModelTableͱEntityʹ͔Εͨ find(SELECT)ͨ͠ͱ͖ + POST͞Εͨͱ͖ POST͞ΕͨσʔλΛEntityԽ͢Δͱ͖ʹόϦσʔγϣϯ͕ಈ͘ ( CakePHP2ͱಉ༷ʹอଘ࣌ʹόϦσʔγϣϯಈ͘
) 1. What is Entity?
2. Entityศརͩͬͨʁ 2. Is Entity useful ?
2. Is Entity useful ? 2. Entityศརͩͬͨʁ 2-1. ॲཧ͕؆ܿʹͳͬͨ ɾFat
Controller -> Fat Model -> ? 2-2. GetterͱSetter ɾ.7$ͷͲ͔͜ΒͰΞΫηεՄೳ
V C M Fat Controller ॳ৺ऀͷ͜Ζ 2. Is Entity useful
?
V C M Fat Model খ׳Ε͖ͯͨ͜Ζ 2. Is Entity useful
?
V C M T E Finder Validation Association Save 2.
Is Entity useful ? ͜ͷ͝Ζ μΠΤοτ
V C M T E μΠΤοτ Finder Validation Association Save
2. Is Entity useful ? ͜ͷ͝Ζ
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() Ͳ͔͜ΒͰΞΫηε
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()
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() Ͳ͔͜ΒͰΞΫηε
2. Is Entity useful ? Getter ྫ) ͱ໊Λͭͳ͛ͯग़ྗ ̎ͭͷϑΟʔϧυΛͭͳ͛ͯग़ྗ ϑΟʔϧυʹॲཧΛՃ͑ͯग़ྗ
ྫ) ֹۚΛ੫ࠐʹ ※ CakePHP2ͷafterFind()͕ෆཁʹͳΔ
2. Is Entity useful ? Setter ྫ) อଘ࣌ͷύεϫʔυΛϋογϡԽ ྫ) ੜ݄ͷอଘͱಉ࣌ʹྸอଘ
อଘ͢Δલͷͷมߋ ผϑΟʔϧυͷͷՃ ※ CakePHP2ͷbeforeSave()ͷهड़͕ݮΔ
2. Is Entity useful ? 2. Entityศརͩͬͨʁ 1Ϋϥε͋ͨΓͷهड़ྔ͕ݮͬͨ ViewͰͷԋࢉࢠͷྔ͕ݮͬͨ ModelͷίʔϧόοΫͷهड़ྔ͕ݮͬͨ
Fat EntityʹͳΒͳ͍ͨΊͷTips ڞ௨ॲཧ5SBJUԽʂ
3. EntityͰϋϚͬͨͱ͜Ζ͋ͬͨʁ
3. EntityͰϋϚͬͨͱ͜Ζ͋ͬͨʁ 1. อଘ࣌ʹ(FUUFS͕Δ 2. ෳճ4FUUFS͕Δ
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Λ࡞͢Δ࣌ҙ
3-2.ෳճ4FUUFS͕Δ ঢ়گ) ϚϧνεςοϓͷϑΥʔϜΛ࡞Γ͍ͨ Request Data Ma Form1 Form2 _setPassword() E
adminadmin dsfknadfgnadflgkng Request Data Ma _setPassword() E dsfknadfgnadflgkng 32ekwnesihwenfansrueaf ͋Εʁ ※EntityͷઃఆΛมߋ͢Ε͍͍͕ɺ ɹɹ Marsherӽ͠ͰઃఆΛมߋͰ͖ͳ͍
3. EntityͰϋϚͬͨͱ͜Ζ͋ͬͨʁ ҙਤ͍ͯ͠ͳ͍λΠϛϯάͰॲཧ͕Δ Entityͷઃఆ৮Γʹ͍͘ EntityҎ֎ͷ෦ͷམͱ݀͋͠·Γͳ͍
·ͱΊ EntityΛ͍͜ͳͤΕɺޮతͳ։ൃ͕Մೳ TableɺEntity͕͔Εͯɺඇৗʹॻ͖͍͢ EntityඇৗʹศརͰCakePHP3Λ͏ͳΒੋඇཧղͯ͠΄͍͠ Entityศརͳɺཧղͯ͠Θͳ͍ͱམͱ͕݀͋͠Γ·͢ PluginΛ࡞Δͱ͖Entityͷಈ͖ʹؾΛ͚ͭͳ͍ͱ͍͚ͳ͍
͍͞͝ʹ FusicςΫϊϩδʔ͕ ͖ͳΤϯδχΞΛืू͍ͯ͠·͢ https://fusic.github.io
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ