I'm new w/ SilverStripe and I've encountered problems w/ class namespacing. I was following the tutorials in the book "Silverstripe The Complete Guide to CMS Development" and got this error:
Warning: There are two files both containing the same class: 'C:\wamp\www\silverstripe/mysite/code/Member.php' and 'C:\wamp\www\silverstripe/sapphire/security/Member.php'. This might mean that the wrong code is being used. in C:\wamp\www\silverstripe\sapphire\core\ManifestBuilder.php on line 461
Maybe atleast silvestripe can implement guidelines w/ it especially when creating new modules to avoid the said error.
For example I'll create a new module let's say "Google". Then there'll be a Map.php class. Then another developer is creating another module "Yahoo". The developer might also create a Map.php class. So there's a conflict and to prevent it, GoogleMap.php class and YahooMap.php class are advisable naming convention.
As I can see with Silverstripe's package modules like cms, it doesn't follow the said convention above. And the chance of class naming conflict is high.
21 July 2010 at 5:41pm
I disagree I have built several larger than average functionality sites and only had this issue once when I wanted to name a file/class Session.php in the end I should have gone for BookingSession which was a better name.
In general [programming hat on] you should give things as desciptive names as possible - so using 2/3 words for each and say there is a conflict because you want a Car DataObject and a Car ModelAdmin... well they clearly should not both be called Car.php...
Yeah! It's true that's my main point (descriptive class name) like my example above. So what's the good class name for Car DataObject and a Car ModelAdmin? You had even experience that problem and as a newbie I would like to read some guidelines on it. :)
And oh yeah I would like to see Silverstripe on PHP 5.3 utilized namespace feature. Are there already actions on it?