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
Junkins
May 26, 2016
Technology
0
860
CakePHP3レポート
PHPカンファレンス福岡2016での登壇資料
Junkins
May 26, 2016
Tweet
Share
More Decks by Junkins
See All by Junkins
FusicTechLive1.5 AWSを活かした基幹システムインフラ構成の紹介
junkins
0
69
マルチ〇〇(リージョン、アカウント)の サービスをまとめてみた!
junkins
0
240
[Fukuoka.php Vol.16]LT CakePHP3を使ってみた:Migration Phinxの話
junkins
0
770
Other Decks in Technology
See All in Technology
[JSAC 2025 LT] Introduction to MITRE ATT&CK utilization tools by multiple LLM agents and RAG
4su_para
1
150
20250122_個人向けCopilotどうなん
ponponmikankan
0
180
SREKaigi.pdf
_awache
2
2.8k
プロダクト価値を引き上げる、「課題の再定義」という習慣
moeka__c
0
120
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
280
MicrosoftのOSSだけでAIによるブラウザテストを構成する
ymd65536
1
220
20250125_Agent for Amazon Bedrock試してみた
riz3f7
2
110
財務データを題材に、 ETLとは何であるかを考える
shoe116
5
1.9k
スクラムマスターの活動と組織からの期待のズレへの対応 / Dealing with the gap between Scrum Master activities and organizational expectations
pauli
2
940
SIEMによるセキュリティログの可視化と分析を通じた信頼性向上プロセスと実践
coconala_engineer
1
2.2k
Japan AWS Jr. Championsがお届けするre:Invent2024のハイライト ~ラスベガスで見てきた景色~
fukuchiiinu
0
1.1k
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
8.9k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.3k
Faster Mobile Websites
deanohume
305
30k
Code Reviewing Like a Champion
maltzj
521
39k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
590
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Facilitating Awesome Meetings
lara
51
6.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
980
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
52k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ