Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Symfonyのアーキテクチャ

 Symfonyのアーキテクチャ

2012/06/30 Symfony勉強会 #6

Katsuhiro Ogawa

July 01, 2012
Tweet

More Decks by Katsuhiro Ogawa

Other Decks in Programming

Transcript

  1. Symfonyの
    アーキテクチャ
    OGAWA Katsuhiro
    2012/06/30 Symfony勉強会#6

    View full-size slide

  2. ‣খ઒༤େ@fivestr
    ‣גࣜձࣾΫϩίε
    ‣ύʔϑΣΫτPHP
    ‣ޮ཰తͳWebΞϓϦ
    έʔγϣϯͷ࡞Γํ
    ‣ઌ೔25ࡀʹͳΓ·ͨ͠
    ABOUT ME

    View full-size slide

  3. AGENDA
    ‣symfony 1.xͷΞʔΩςΫνϟ
    ‣Symfony2ͷΞʔΩςΫνϟ
    ‣ORMͷΞʔΩςΫνϟ
    ‣ΞʔΩςΫνϟʹؔ͢Δࢀߟॻ੶

    View full-size slide

  4. アーキテクチャとは
    ‣ιϑτ΢ΣΞͷʮઃܭࢥ૝ʯ
    ‣ʮߏ଄ʯΛࢦ͢৔߹΋͋Δ

    View full-size slide

  5. symfony 1
    ‣WebΞϓϦέʔγϣϯϑϨʔϜ
    ϫʔΫ
    ‣ػೳ͕๛෋
    ‣࣮੷ଟ਺
    ‣Delicious, Dailymotion

    View full-size slide

  6. フレームワークの内部
    ‣symfony͸ػೳ͕๛෋
    ‣ೝূ؅ཧ
    ‣ϧʔςΟϯά
    ‣ϑΥʔϜ
    ‣ςϯϓϨʔτ
    ‣ϩΪϯά

    View full-size slide

  7. フレームワークの内部
    ‣framework
    ‣૊Έ߹ΘͤͯWebΞϓϦͷϑ
    ϨʔϜϫʔΫͱͯ͠ػೳ͢Δ
    ‣platform
    ‣୯ମͰ΋ར༻ՄೳͳϥΠϒϥϦ
    ‣symfony 1.1͔Β໌֬ʹ

    View full-size slide

  8. フレームワークの内部
    ‣platform෦෼ʹ͓͚ΔϥΠϒϥϦ
    ͷ֦ு͸Մೳ͕ͩɺ಺෦Ͱ͸ΘΓ
    ͱڧҾͰ൚༻ੑͷͳ͍࣮૷ʹͳͬ
    ͍ͯͨ

    View full-size slide

  9. プラグイン
    ‣ผͷϥΠϒϥϦͳͲΛ؆୯ʹ૊Έ
    ࠐΊΔΑ͏ʹ͢Δ࢓૊Έ
    ‣Doctrine΍jQuery
    ‣ࣗ෼Ͱ΋࡞ΕΔ
    ‣ձࣾͰڞ௨ϥΠϒϥϦΛ࡞Δ

    View full-size slide

  10. プラグイン
    ‣ϓϥάΠϯͷ࢓૊Έͷ͓͔͛Ͱ؆
    ୯ʹϑϨʔϜϫʔΫͷ֦ு΋Մೳ
    ʹ

    View full-size slide

  11. プラグイン
    ‣࠷ॳ͔ΒϓϥάΠϯ಺ͰΞϓϦΛ
    ։ൃ͢Δ͜ͱ΋࢓૊Έ্Մೳ
    ‣ΞϓϦ͝ͱ࢖͍ճͤΔ

    View full-size slide

  12. Symfony2
    ‣symfonyͷޙܧʹ౰ͨΔSymfony2
    ‣Ұ͔Βॻ͖௚͞ΕͨͨΊɺ1ܥͱ
    ͸·ͬͨ͘΂ͭ΋ͷͱݴΘΕΔ͜
    ͱ΋ଟ͍
    ‣࣮੷͋Γ

    ‣Overblog

    View full-size slide

  13. symfony 1とSymfony2
    ‣frameworkͱplatform͕ΑΓ໌֬
    ʹ෼཭͞Εͨ
    ‣ਓؾͩͬͨϓϥάΠϯͷ࢓૊Έ͕
    ΑΓ౰ͨΓલͷ΋ͷʹ
    ‣BundleͱComponent

    View full-size slide

  14. Component
    ‣୯ମͰར༻ՄೳͳϥΠϒϥϦΛ
    ύοέʔδԽͨ͠΋ͷ͕

    View full-size slide

  15. Component
    ‣EventDispatcher
    ‣Routing
    ‣Templating
    ‣Yaml
    ‣HttpKernel
    ‣...

    View full-size slide

  16. Bundle
    ‣ϓϥάΠϯͷΑ͏ͳ࢓૊Έ
    ‣ϑϨʔϜϫʔΫͷػೳ΋Bundleͱ
    ͯ͠ఏڙ͞Ε͍ͯΔ
    ‣FrameworkBundle

    View full-size slide

  17. Bundle
    ‣ΞϓϦ΋Bundleͱͯ͠࡞੒
    ‣StoreBundle
    ‣ϥΠϒϥϦ࿈ܞ
    ‣DoctrineBundle
    ‣MonologBundle

    View full-size slide

  18. Bundle
    ‣ΞϓϦͷίʔυ΋Bundleͷதʹ࡞
    Δ
    ‣͢΂ͯͷػೳ͕Bundleͱͯ͠ύο
    έʔδԽ͞ΕΔͨΊɺ͍ͭͰ΋࠶
    ར༻Մೳ

    View full-size slide

  19. DIコンテナ
    ‣ґଘؔ܎ͷ؅ཧΛҾ͖ड͚Δ
    ‣ίϯϙʔωϯτؒͷґଘ͸DIίϯ
    ςφʹઃఆ͞ΕΔ
    ‣DependencyInjection

    View full-size slide

  20. Symfony2のアーキテクチャ
    ‣Symfony2Ͱ͸ɺBundleͱ
    Componentͱ͍͏֓೦͕ొ৔ͨ͠
    ͕ɺߟ͑ํ͸symfony 1ͷ͔࣌Β
    ଘࡏ͍ͯͨ͠

    View full-size slide

  21. Symfony2のアーキテクチャ
    ‣symfony 1ͷ͜Ζɺґଘੑͷ؅ཧ
    ͕ෳࡶԽ͍͕ͯͨ͠ɺDIίϯςφ
    ͷ࠾༻ʹΑΓ֦ுͷํ๏͕౷Ұ͞
    Εͨ

    View full-size slide

  22. フレームワークとして
    ‣Symfony2͸1͔Βॻ͔ΕͨͨΊ࣮
    ૷ͦ͜΂ͭ΋ͷ͚ͩͲɺઃܭࢥ૝
    ͷ෦෼͸symfony 1͔Βड͚ܧ͕
    Ε͍ͯΔ

    View full-size slide

  23. ORMのアーキテクチャ
    ‣symfony 1ͱSymfony2Ͱ͸ɺ
    ORM(Doctrine)ͷΞʔΩςΫνϟ
    ͕มߋ͞Ε͍ͯΔ
    ‣symfony 1: Active Record
    ‣Symfony2: Data Mapper

    View full-size slide

  24. ORMのアーキテクチャ
    ‣Active Record
    ‣$record->save();
    ‣Data Mapper
    ‣$mapper->save($record);

    View full-size slide

  25. Active Record
    ‣ߦ(=Record)ΦϒδΣΫτ͕σʔ
    λϕʔεʹΞΫηε͢ΔػೳΛ
    ͍࣋ͬͯΔ

    View full-size slide

  26. Active Record
    ‣ར༻͕؆୯
    ‣ΦϒδΣΫτ͕ORMͷ੍໿Λड͚
    Δ

    View full-size slide

  27. Active Record
    ‣ػೳΛ࣋ͬͨΫϥεΛܧঝ͢Δ
    ‣DoctrineͳΒDoctrine_Record
    ‣PropelͳΒBaseObject
    ‣ΦϒδΣΫτ͕ORMͷ੍໿Λड͚
    Δ

    View full-size slide

  28. Data Mapper
    ‣ߦΦϒδΣΫτʹ͸खΛग़͞ͳ͍
    ‣ܧঝෆཁ
    ‣Plain Old PHP Object
    ‣DataMapperΦϒδΣΫτΛհ͠
    ͯσʔλϕʔε΁ΞΫηε͢Δ

    View full-size slide

  29. Data Mapper
    ‣Data Mapperͷ৔߹ɺΦϒδΣΫ
    τʹ੍ݶ͕͔͔Βͳ͍ͨΊࣗ༝౓
    ͕ߴ͍

    View full-size slide

  30. 参考書籍
    ‣ΞʔΩςΫνϟΛਂ͘஌Δʹ͸ɺ
    ྑ࣭ͳॻ੶ΛಡΉͷ͕Α͍
    ‣͍͍ͩͨߴ͍͚ͲɺΑ͍ຊ͸૬
    ԠͷՁ஋͕͋Δ

    View full-size slide

  31. PofEAA
    ‣ΤϯλʔϓϥΠζΞ
    ϓϦέʔγϣϯΞʔ
    ΩςΫνϟύλʔϯ
    ‣http://
    www.amazon.co.jp/
    dp/4798105538

    View full-size slide

  32. ご清聴ありがとう
    ございました。

    View full-size slide