RECOMMIT This is a recommit of a previously merged, but reverted, commit. The initial commit had problems when running "tests/all flush=all" when dev/build would re-analyse a bunch of stuff; fixes to address this went into https://github.com/silverstripe/sapphire/pull/487, but for some reason the actual base changes didn't, so I'm re-submitting them in a separate pull.

BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through

CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
If a DataObject has a many_many to a SiteTree subclass, and that subclass has no database fields defined, and $this->name is "ID", this function will errantly return "SiteTreeSubClass.ID", which can never exist in a search query, since there is no such table as SiteTreeSubClass. The problem is that DataObject::hasOwnTableDatabaseField() is a little eager when passed an argument of "ID." It doesn't check to see if the object has its own table first.
MINOR Use injector for creating Member_GroupSet object

MINOR Use injector for creating many many list objects

MINOR Use injector for creating objects from within the DataList

MINOR Use Injector::inst() for creating objects; cannot rely on this->injector being present due to many classes being created with 'new', so use inst() directly

MINOR Remove injector autoset property for now; automatically setting it breaks a few test cases that don't know about it for now, and it's not needed just yet
BUGFIX: Handling of classes with namespaces in database

MySQLDatabase::enumValuesForField() - Added stripslashes because backslashes are escaped in the type description

DataObject::requireTable() - Added double quotes to column names in automatically generated indexes for many_many relationships

DataObject::write() - Escaped class name for DB query

DataQuery::getFinalisedQuery() - Escaped class names for DB query
Merge pull request #503 from nyeholt/injector_updates

Changes to use injector for creating some classes to ensure injection of dependencies
Merge pull request #504 from schmengler/namespace-fixes-rc1

BUGFIX: Handling of classes with namespaces in database
Merge pull request #500 from nyeholt/injector_strong_create

RECOMMIT This is a recommit of a previously merged, but reverted, commit...
Merge pull request #502 from unclecheese/patch-2

If a DataObject has a many_many to a SiteTree subclass...
BUGFIX: Fixed ORM bugs introduced in ec554689325765881a83df6f87c34efe80c92961