theruss

It's also the way you deal with a persistant DB in dev envs, otherwise your transient containers take all their data with them

theruss

Issue is documented here (FYI) https://github.com/silverstripe/silverstripe-framework/issues/8099

Show 1 attachment(s)
Zazama

Affected Version

4.1.1

Description

When setting TEMP_PATH to e.g. "silverstripe-cache" in the .env file, the cache folder is created inside the public folder instead of the base path.
TEMP_PATH="silverstripe-cache"

Expected:
/path/to/silverstripe/silverstripe-cache
Output:
/path/to/silverstripe/public/silverstripe-cache

Is this the expected output? If yes, is there another way to set the cache folder to the root path instead of using a rather "hacky" ../silverstripe-cache? Because defining it in the _config.php throws an error that it's already defined.

Steps to Reproduce

• Use public folder structure. • Set e.g. TEMP_PATH in .env file

Hide attachment content
theruss

She's still there and causing problems

theruss

By default, SilverStripe will write its cache files to "/tmp/silverstripe-cache-whatever" (You can alter that by declaring TEMP_DIR as an environment var) or if SilverStripe encounters a "silverstripe-cache" dir in its document root, it will use that. Use any one of these that suits you and your app, and map it to a Docker volume within your Dockerfile.

theruss

@Nik Have a look at ViewableData::__get() 🙂

Nik

Looks good, although I don't get how summary_fields resolves a method without a getMethod? An entry named SomeMethod will work, even without having a getSomeMethod function, but just a SomeMethod function. How? Follow up would be how dot notation is being parsed, although for that I found GridFieldDataColumns.getValueFromRelation - not sure if it's the correct one

Nik

Thanks for your help with this 🙂

theruss

AFAIK $summary_fields will resolve methods without a "get" prefix, only if they're declared either as first-class, class-properties or through having been declared as a "Field" (which silverstripe defines as being a field in $db or in $has_one)

theruss

You can test this by declaring a randomly method Wibble() that returns the string "Pencils up nose" (Blackadder episode...) and calling it from $summary_fields.

theruss

If that works, and your GridField displays a column each of who's cells shows "Pencils up nose", then I couldn't tell you what sorcery was doing that...

Nik

So I have a method called Preview that is mapped to in summary_fields - it's literally just a method, and it returns a DBText. And that works - which I couldn't figure out

theruss

Can I ask why you might want to do this?

theruss

Interesting question. The ::create() name is widely used in many factories, in and outside of SilverStripe land.

theruss

The one that uses a picture of a conductor and not a composer... LOL

theruss

Anyway - the answer to your question should be found in the composer docs