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

EC-CUBE3コードリーディング #1

amidaike
February 03, 2016

EC-CUBE3コードリーディング #1

amidaike

February 03, 2016
Tweet

More Decks by amidaike

Other Decks in Programming

Transcript

  1. ࢖༻͍ͯ͠ΔϑϨʔϜϫʔΫ • Twigʹ͍ͭͯ
 PHPςϯϓϨʔτΤϯδϯͰ͋ΓɺSymfony2Λߏ੒͢Δඪ४ύο έʔδͷҰ෦Ͱ͢ɻ(EC-CUBE2ܥͰ͸SmartyΛ࠾༻) • Twigͷಛ௃ 1. ߴ଎ :

    ࠷దԽ͞ΕͨPHPίʔυͰςϯϓϨʔτΛίφϐϧ͠ɺ ௨ৗͷPHPίʔυʹൺ΂ͯΦʔόʔϔουΛ࠷খݶʹݮগ 2. ηΩϡΞ : ࣗಈΤεέʔϓػೳ΍৴པ͞Ε͍ͯͳ͍ςϯϓϨʔ υίʔυΛධՁ͢ΔͨΊͷsandboxϞʔυΛඋ͑Δ 3. ॊೈੑ : ಠࣗͷΧελϜλά΍ϑΟϧλΛఆٛ͢Δ͜ͱ͕Մೳ
  2. EC-CUBE3ͷσΟϨΫτϦߏ଄ σΟϨΫτϦ໊ ػೳ໊ Eccube௚Լ ϕʔεͱͳΔApplication.php͕ଘࡏ͠ɺඞ ͣ͜ͷΫϥε͔Β࣮ߦ͞ΕΔ Application Application.phpͷ਌ΫϥεϑΝΠϧ͕֨ೲ Command ConsoleίϚϯυ༻Ϋϥε

    Common ఆ਺ఆٛΫϥε Controller ίϯτϩʔϥʔΫϥε ControllerProvider URLϚοϐϯάఆٛؔ਺ Doctrine Doctirine֦ுΫϥε Entity DB࿈ܞ༻EntityΫϥε Event FormΠϕϯτ༻Ϋϥε EventListner ΠϕϯτϦεφʔ༻Ϋϥε
  3. EC-CUBE3ͷσΟϨΫτϦߏ଄ σΟϨΫτϦ໊ ػೳ໊ Exception ۀ຿ΤϥʔΫϥε Form FormλΠϓΫϥε Plugin ϓϥάΠϯ༻ManagerΫϥε Repository

    DBΞΫηε༻ϦϙδτϦΫϥε Resource doctrine༻dcmϑΝΠϧ΍twigϑΝΠϧ౳ Security ύεϫʔυϋογϡ༻Ϋϥε΍ݖݶνΣο ΫΫϥε Service αʔϏεΫϥε ServiceProvider DIఆٛ༻Ϋϥε Twig Twig֦ு༻Ϋϥε Util ڞ௨ؔ਺Ϋϥε
  4. σʔλϕʔεߏ଄ʹ͍ͭͯ • ໋໊ن໿ͷϧʔϧ
 ল໊ུশͷഇࢭ : dtb_deliv → dtb_delivery
 ୯਺ܗʹมߋ :

    dtb_products → dtb_product
 εωʔΫέʔεͰ໋໊ : dtb_class_category • ςʔϒϧʹ͸छผʹΑΓϓϨϑΟΫεΛ͚ͭΔ
 Ϛελςʔϒϧ : mtb_hogehoge
 σʔλςʔϒϧ : dtb_hogehoge
 ϓϥάΠϯؔ࿈ : plg_hogehoge
  5. ରԠϒϥ΢βʹ͍ͭͯ OS ϒϥ΢β Windows (Windows7Ҏ߱) Internet Explorer10 Ҏ߱ Google Chrome

    ࠷৽൛ Firefox ࠷৽൛ Mac Safari ࠷৽൛ iOS(7Ҏ߱) Safari ࠷৽൛ Android(4.1Ҏ߱) ඪ४ϒϥ΢β ࠷৽൛
  6. URLͷ֬ೝํ๏ $ php app/console router:debug +----------------------------------------+-----------------------------------------------------------+---------+ | Name | Path

    | Pattern | +----------------------------------------+-----------------------------------------------------------+---------+ | admin_logout | /admin/logout | GET | | admin_login_check | /admin/login_check | | | logout | /logout | GET | | login_check | /login_check | | | user_data | /user_data/{route} | ANY | | homepage | / | ANY | | top | / | ANY | | index | / | ANY | | cart | /cart | ANY | | cart_add | /cart/add | POST | | cart_up | /cart/up/{productClassId} | ANY | | cart_down | /cart/down/{productClassId} | ANY | | cart_set_quantity | /cart/setQuantity/{productClassId}/{quantity} | ANY | | cart_remove | /cart/remove/{productClassId} | ANY | | cart_buystep | /cart/buystep | ANY | | contact | /contact | ANY | | contact_complete | /contact/complete | ANY | | entry | /entry | ANY | | entry_complete | /entry/complete | ANY | | entry_activate | /entry/activate/{secret_key} | ANY | | forgot | /forgot | ANY | | forgot_reset | /forgot/reset/{reset_key} | ANY | | block_category | /block/category | ANY | php app/console router:debug
  7. σόοάϞʔυͷ༗ޮԽ • ௨ৗ/΍/index.phpͰΞΫηε͍ͯ͠ΔURLΛ/index_dev.phpʹมߋͯ͠ΞΫηε͢Δ͜ͱʹΑΓɺtwig ϑΝΠϧ͕Ωϟογϡ͞ΕͣʹσόοάϞʔυ͕༗ޮʹͳΓ·͢ɻ
 
 ˞EC-CUBE3.0.8͔Βdump༻ϥΠϒϥϦΛಋೖͨ͜͠ͱʹΑΓɺύοέʔδ൛ͩͱ index_dev.php ͕ͦ ͷ··ͩͱ࢖͑·ͤΜɻindex_dev.php Λ࢖͑ΔΑ͏ʹ͢ΔͨΊʹ͸EC-CUBEσΟϨΫτϦ௚ԼͰɺҎ

    ԼͷίϚϯυΛೖྗ͍ͯͩ͘͠͞ɻ
 curl -sS https://getcomposer.org/installer | php
 Λ࣮ߦޙɺ
 php composer.phar update symfony/var-dumper symfony/debug-bundle
 Λ࣮ߦ͍ͯͩ͘͠͞ɻ(3.0.9͔Β͸ؚ·ΕΔΑ͏ʹͳΓ·͢)
 http://localhost/index_dev.php • You are not allowed to access this file. Check index_dev.php for more information.ͱΤϥʔ͕දࣔ͞Ε Δ৔߹ɺindex_dev.phpΛ։͖ɺΞΫηεݩͷIPΛҎԼͷ഑ྻʹ௥Ճ͍ͯͩ͘͠͞ɻ 
 $allow = array( '127.0.0.1', 'fe80::1', '::1', );