These are chat archives for 2x2studio/2x2

28th
Jan 2016
Crow
@2x2studio
Jan 28 2016 16:47
function process($request){
     $user = $this->builder->....;
     if($user == null && in_array($request->attributes()->get('processor'), $this->protectedProcessors)){
          return $someRedirectResponse;
     } 
     return parent::process($request);
}
в папке /src/Project/Framework/ sozdajesh Configuration.php
namespace Project\Framework;
class Configuration extends \PHPixie\BundleFramework\Configuration{
     private function buildHttpProcessor()
    {
          return new YourAwesomeProcessor(parent::buildHttpProcessor());
    }
}
class YourAwesomeProcessor implements \PHPixie\Processors\Processor\Selective{
       protected $httpProcessor;
       public function __construct($httpProcessor) {
                $this->httpProcessor = $httpProcessor;
       }

       public function isProcessable($request){
             return $this->httpProcessor->isProcessable($request);
       }


       public function process($request){
             if(/*check if page is accessable*/) {
                   return $this->httpProcessor->isProcessable($request);
             }
              return /* redirect to login page*/ ;
       }
}