I’m in the process of upgrading a task from another site that run v3.6, part of which uses an extended SiteConfig. In 3.6, the following would work:
SiteConfig::current_site_config();
However, this doesn’t work in my 4.1 version. I admit - it’s highly likely to be me as I’m just getting to grips with v4, but even following a guide from the SS website (which shows the same as above), doesn’t work.
As I said, likely I’m missing something obvious (especially on a Monday morning!), but any help appreciated!
I am so sorry. I can’t believe I even posted that . It’s one of my bugbears too…
The error I see is:
Error: Class 'SilverStripe\Site\SiteConfig' not found
Which is why I believe it’s more of a me issue. I’ve looked through some of the docs, and found plenty of examples of using them in templates (which I’ve done successfully), but very few examples of using them in a PHP class, like a BuildTask. This is one example that I found, but it’s very very basic. The tutorial doesn’t seem to touch on this either, only the template side of things (unless I’m missing something - which is highly possible!)