Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tractorcow/silverstripe-proxy-db
Use proxy for DB
https://github.com/tractorcow/silverstripe-proxy-db
Last synced: 3 months ago
JSON representation
Use proxy for DB
- Host: GitHub
- URL: https://github.com/tractorcow/silverstripe-proxy-db
- Owner: tractorcow
- Created: 2018-02-16T00:25:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-19T01:17:44.000Z (10 months ago)
- Last Synced: 2024-09-19T12:36:37.866Z (4 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Database proxy
Ok, so you want to proxy the database.
Install this module, and decorate the factory with code you want to extend
```yaml
---
Name: myproxydb
After: '#proxydb'
---
TractorCow\SilverStripeProxyDB\ProxyDBFactory:
extensions:
- ProxyDBExtension
```Then in your code you can do this
```php
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.