2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-proxy-db

image

tractorcow/silverstripe-proxy-db

  • Tuesday, June 12, 2018
  • by robbieaverill
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,725 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 189 % Grown

The README.md

Database proxy

Ok, so you want to proxy the database., (*1)

Install this module, and decorate the factory with code you want to extend, (*2)

---
Name: myproxydb
After: '#proxydb'
---
TractorCow\SilverStripeProxyDB\ProxyDBFactory:
  extensions:
    - ProxyDBExtension

Then in your code you can do this, (*3)

<?php

use SilverStripe\Core\Extension;
use TractorCow\ClassProxy\Generators\ProxyGenerator;

class ProxyDBExtension extends Extension
{
    public function updateProxy(ProxyGenerator &$proxy)
    {
        $proxy = $proxy->addMethod('manipulate', function ($args, $next) {
            SearchManipulator::manipulate($args[0]);
            return $next(...$args);
        });
    }
}

You can chain methods; All addMethod() calls on the same method name will form a set of middleware. First methods registered are executed first., (*4)

The Versions

12/06 2018
16/02 2018