Skip to content

Instantly share code, notes, and snippets.

View sminnee's full-sized avatar

Sam Minnée sminnee

View GitHub Profile
diff --git a/src/Forms/FormRequestHandler.php b/src/Forms/FormRequestHandler.php
index 8976711..1edd94f 100644
--- a/src/Forms/FormRequestHandler.php
+++ b/src/Forms/FormRequestHandler.php
@@ -228,7 +228,7 @@ class FormRequestHandler extends RequestHandler
// First, try a handler method on the controller (has been checked for allowed_actions above already)
$controller = $this->form->getController();
if ($controller && $controller->hasMethod($funcName)) {
- return $controller->$funcName($vars, $this->form, $request);
+ return $controller->$funcName($vars, $this->form, $request, $this);
diff --git a/src/Dev/Debug.php b/src/Dev/Debug.php
index 06d7ec9..38f1947 100644
--- a/src/Dev/Debug.php
+++ b/src/Dev/Debug.php
@@ -8,6 +8,8 @@ use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DB;
use SilverStripe\Security\Permission;
use SilverStripe\Security\Security;
+use Psr\Log\LoggerInterface;
+
@sminnee
sminnee / gist:a99ff6888fc0e5a60095fe701a884a4f
Last active April 18, 2017 05:49
logging queries to php-console
diff --git a/composer.json b/composer.json
index 05214e4..6cb25d8 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,13 @@
"silverstripe/reports": "4.0.x-dev",
"silverstripe/siteconfig": "4.0.x-dev",
"silverstripe/versioned": "1.0.x-dev",
- "silverstripe-themes/simple": "~3.2.0"
+ "silverstripe-themes/simple": "~3.2.0",
@sminnee
sminnee / ss3php7.md
Last active March 28, 2017 23:42
RFC: PHP7 support in SS3

RFC: PHP7 support in SilverStripe 3

Problem: we only have ~15 months between SS4 stable release and SS3 end-of-life.

Right now SS3's end-of-life is tied to the end-of-life of the PHP version that it requires - 5.6. This is December 2018. We're targetting an October 2017 release for SS4 stable, which only leaves a 15 months window for people to upgrade.

For comparison, we had 33 months (2 years, 9 months) between 3.0 being released and 2.4 being end-of-life'd.

15 months is too short a window and we would like a minimum of 2 years.

diff --git a/tests/php/ORM/VersionedTest.php b/tests/php/ORM/VersionedTest.php
index 003e56e..e99668a 100644
--- a/tests/php/ORM/VersionedTest.php
+++ b/tests/php/ORM/VersionedTest.php
@@ -1021,6 +1021,35 @@ class VersionedTest extends SapphireTest
}
/**
+ * Test that that stage a record was queried from cascades to child relations, even if the global stage has changed
+ */
@sminnee
sminnee / app-rfc.md
Created February 22, 2017 05:17
App RFC [wip]

Problem

There are a few issues with the current SilverStripe 4 code:

  • Our bootstrap is a large pile of spaghetti. This makes it harder to build other scripts that pull in SilverStripe services.
  • There are a lot of top-level anchors of global state - Injector::inst(), Config::inst(), etc, that need to managed. This is especially clear in the case of test execution
  • We're increasingly using Injector, and combined with fully-qualified interface/class names as the service names, makes sonme

These issues could be solved with an App object

@sminnee
sminnee / db-config.yml
Created February 22, 2017 04:58
Potential SS4 db config
---
Name: msyql-database
Only:
Env:
SS_DB=mysql
---
SilverStripe\Core\Injector\Injector:
SilverStripe\ORM\Connect\Database:
class: 'SilverStripe\ORM\Connect\MySQLDatabase'
properties:
diff --git a/cli-script.php b/cli-script.php
index 7880e90..44c9327 100755
--- a/cli-script.php
+++ b/cli-script.php
@@ -89,41 +89,39 @@ else {
*/
require_once("Core/Core.php");
-global $databaseConfig;
-
diff --git a/main.php b/main.php
index daa214c..dcbc9de 100644
--- a/main.php
+++ b/main.php
@@ -149,10 +149,6 @@ $chain
// Load in core
require_once('Core/Core.php');
- // Connect to database
- global $databaseConfig;
diff --git a/main.php b/main.php
index daa214c..dcbc9de 100644
--- a/main.php
+++ b/main.php
@@ -149,10 +149,6 @@ $chain
// Load in core
require_once('Core/Core.php');
- // Connect to database
- global $databaseConfig;