nightjarnz

@Admonish Helpers need not be in their own class (entirely full of helpers) though. E.g. if generateUniqueID is specific to ... Member - Member::generateUniqueID() - and does not have context outside member, then leaving it in the Member class is fine. If it's static and public it can still be called from anywhere. If it's Unique globally (throughout the entire system) and not tied to any particular class, then you'd think about putting it somewhere else that makes sense in such a global context E.g. perhaps on a boot class called "App", or into a helper class as you describe.

nightjarnz

@Admonish ClassInfo is a helper class in Framework you could look at :)

Admonish
Files: Requires logging in with Slack to view/download
DataObjectFile.php
Admonish

I bring this up now because I am currently working with a method called generateUniqueID() that I had created awhile back inside one of my DataObjects. Now I'm wondering if I should strip it out into its own helper class.

Admonish

I have a tendancy to try to make something static if it can be made static. But now I'm thinking that I should only make it static if its somethig pretty generic and reusable E.g. a Math helper classes for generic math formulas

Admonish

So my question is what is the best way to make a helper class in silverstripe and (more importantly) when should I remove a method from a controller or DataObject and place it in a helper class?

Admonish

Hey guys n gals. So Lately I have been researching into best practices and design patterns trying to up my php game and one of the things that became glaringly obvious to me way my misuse of static methods up to this point. From what I understand now I should only be using static methods in helper classes so that I don't cause unit testing problems (among other things).

Ral Little

I usually just work on my vm via samba

Firesphere

I don't like exposing Samba on a production machine

Ral Little

Well yeah, I use samba on development machines not production. Maybe SSHFS-Win? I haven't used it but it should work like mapping a samba network location except with more security.