CakePHP3レポート

 CakePHP3レポート

PHPカンファレンス福岡2016での登壇資料

04052627dc708df299afd3aff44dde27?s=128

Junkins

May 26, 2016
Tweet

Transcript

  1. 3.

    Agenda CakePHP3 Ϩϙʔτ ࣮ࡍʹҊ݅Ͱ࠾༻ͨ͠ॴײ (ྑ͔ͬͨͱ͜Ζɺѱ͔ͬͨͱ͜Ζ) Model ( TableɺEntity ) 1.

    EntityͬͯԿʁ 2. Entity͸ศརͩͬͨʁ 3. EntityͰϋϚͬͨͱ͜Ζ͋ͬͨʁ ࠓ·Ͱ$BLF1)1Λ࢖͍ͬͯͯɺ͜Ε͔Β$BLF1)1Λ࢖͏ํ޲͚ CakePHP2ͱͷൺֱ͕ͪΐͪ͜ΐ͜ɻɻɻɻ
  2. 6.

    1. What is Entity? V C M MVC Model View

    Controller View Controller Model
  3. 9.
  4. 10.

    T 1. What is Entity? E ɾ$BLF1)1ͷʮ.PEFMʯʹ͍ۙ໾ׂ Table Entity ɾ%#ͷʮ5BCMFʯ΁ͷΞΫηε

    ɾσʔλϨίʔυ TableͱEntity ɾϨίʔυ͝ͱʹΠϯελϯεԽ ɾ഑ྻͰ͸ͳ͍ͷͰ֦ு͕༰қ ɾ7BMJEBUJPO Associationͷઃఆ
  5. 11.

    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
  6. 14.

    2. Is Entity useful ? 2. Entity͸ศརͩͬͨʁ 2-1. ॲཧ͕؆ܿʹͳͬͨ ɾFat

    Controller -> Fat Model -> ? 2-2. GetterͱSetter ɾ.7$ͷͲ͔͜ΒͰ΋ΞΫηεՄೳ
  7. 17.

    V C M T E Finder Validation Association Save 2.

    Is Entity useful ? ͜ͷ͝Ζ μΠΤοτ
  8. 18.
  9. 19.

    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() Ͳ͔͜ΒͰ΋ΞΫηε
  10. 20.

    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()
  11. 21.

    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() Ͳ͔͜ΒͰ΋ΞΫηε
  12. 23.

    2. Is Entity useful ? Setter ྫ) อଘ࣌ͷύεϫʔυΛϋογϡԽ ྫ) ੜ೥݄೔ͷอଘͱಉ࣌ʹ೥ྸ΋อଘ

    อଘ͢Δલͷ஋ͷมߋ ผϑΟʔϧυ΁ͷ஋ͷ௥Ճ ※ CakePHP2ͷbeforeSave()ͷهड़͕ݮΔ
  13. 27.

    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Λ࡞੒͢Δ࣌͸஫ҙ
  14. 28.

    3-2.ෳ਺ճ4FUUFS͕૸Δ ঢ়گ) ϚϧνεςοϓͷϑΥʔϜΛ࡞Γ͍ͨ Request Data Ma Form1 Form2 _setPassword() E

    adminadmin dsfknadfgnadflgkng Request Data Ma _setPassword() E dsfknadfgnadflgkng 32ekwnesihwenfansrueaf ͋Εʁ ※EntityͷઃఆΛมߋ͢Ε͹͍͍͕ɺ ɹɹ Marsherӽ͠Ͱ͸ઃఆΛมߋͰ͖ͳ͍