Laravel with Aspect Oriented Architecture

Laravel with Aspect Oriented Architecture

17d4ef53b432ebf7c566fd6a11345570?s=128

yuuki takezawa

June 17, 2016
Tweet

Transcript

  1. 3.

    ϓϩάϥϜ͸Ͳ͏͋Δ΂͖͔ʁ • ίϯϙʔωϯτΛϕʔεʹγεςϜΛߏங͍ͯ͘͠Ұൠ తͳύλʔϯ • ΫϥεɺύοέʔδɺαʔϏεͳͲͷίϯϙʔωϯτʹ
 ཁٻΛׂΓ౰ͯͯߟ͑Δ • େମͷύλʔϯͰ͸ޮՌతʹίϯϙʔωϯτͱͯ͠࡞༻ •

    ޮՌతͰ͸ͳ͍ύλʔϯͱ͸ɺଞͷίϯϙʔωϯτʹ ӨڹΛ༩͑ͯ͠·͏΋ͷ͕෼཭Ͱ͖ͳ͍ύλʔϯͰ͋Γɺ ͜Ε͸େ͖ͳΞϓϦέʔγϣϯʹͳΕ͹ͳΔ΄Ͳ໰୊ ͱͳΓ·͢ɻ
  2. 9.

    /** * @param $id * * @return mixed * @throws

    \Exception */ public function makeReservation($id) { if ($this->reserve->getQuantity($id)) { return $this->reserve->createReservation($id); } throw new \NoRoomException(); }
  3. 12.

    /** * @param $id * @WaitingList * @return mixed *

    @throws \Exception */ public function makeReservation($id) { if ($this->reserve->getQuantity($id)) { return $this->reserve->createReservation($id); } throw new \NoRoomException(); }
  4. 17.

    // contextual bind͔Ͳ͏͔ if (isset($this->app->contextual[$class])) { // $this->resolveContextualBindings($class, $compiledClass); }

    // ίϯύΠϧͨ͠Ϋϥε΁ͱೖΕସ͑Δ $this->app->bind($class, function ($app) use ($bind, $compiledClass) { $instance = $app->make($compiledClass); $instance->bindings = $bind->getBindings(); return $instance; });
  5. 19.

    σϑΥϧτͰ༻ҙ͞ΕͨΞϊςʔγϣϯ • @Transactional (Ξϥ΢ϯυΞυόΠε)
 ΞϊςʔγϣϯΛهड़ͨ͠ϝιουͷॲཧத͸
 σʔλϕʔεͷτϥϯβΫγϣϯΛ࣮ߦ͢Δ • @Loggable (Ξϥ΢ϯυΞυόΠε)
 ΞϊʔςʔγϣϯΛهड़ͨ͠ϝιουͷ࣮ߦ࣌ؒɺ


    Ҿ਺ɺ໭Γ஋ΛϩΪϯά • @LogExceptions (ΞϑλʔΞυόΠε)
 ΞϊςʔγϣϯΛهड़ͨ͠ϝιουͰ
 ΤΫηϓγϣϯ͕εϩʔ͞Εͨ৔߹ʹҾ਺ΛϩΪϯά
 ͦͷ··ϋϯυϥʔ΁εϩʔ͢Δ
  6. 20.

    ࣮ࡍʹ࢖ͬͨྫ • @Meta (ΞϑλʔΞυόΠε)
 Template΁metaλάΛૠೖ(canonical΍pageͳͲ) • @Cacel (ΞϑλʔΞυόΠε)
 ಛఆͷ৚݅ԼͰ༧໿ͷΩϟϯηϧΛߦ͏ •

    @PThread (Ξϥ΢ϯυΞυόΠε)
 ผεϨουͰ֘౰ͷϝιουΛ࣮ߦ͢Δ • @Queue (Ξϥ΢ϯυΞυόΠε)
 ΞϊςʔγϣϯͰࢦఆ͞ΕͨϝιουͷॲཧΛ
 QueueʹೖΕΔ