コード例 #1
0
 /**
  * @param Before $flow
  */
 public function handle(Before $flow)
 {
     /**
      * @var RepositoryInterface|Adjustable $repository
      */
     $repository = $flow->getRepository();
     $criterias = $repository->getCriterias();
     array_walk($criterias, function (&$criteria) use(&$repository) {
         /**
          * @var \Housekeeper\Contracts\CriteriaInterface $criteria
          */
         $repository->applyCriteria($criteria);
     });
 }
コード例 #2
0
 /**
  * @param Before $flow
  */
 public function handle(Before $flow)
 {
     $action = $flow->getAction();
     /**
      * Only get cache when Action is "Read".
      */
     if ($action->isType(Action::READ)) {
         $cacheKey = $this->getCacheKey($flow);
         $cachedValue = $this->getCache($cacheKey);
         if (!is_null($cachedValue)) {
             $flow->setReturn($cachedValue);
         }
     }
 }