View more context

 

taoceanz

I've thought to do Config::Inst()->get('\MyNamespace\IsWellNamed\MyClass', 'table_name'); but that isn't fool proof. Was hoping for an existing method within the framework to attain table name.

phyzical

yeah i couldnt see one on a quick search

phyzical

it uses $tableName = $dataObjectSchema->tableName($dataClass);

phyzical

$dataObjectSchema = DataObject::getSchema();

phyzical

so DataObject::getSchema()->tableName(MYCLASS::class); ?

taoceanz

Nice find @phyzical. Lol, this is from documentation of the tableName function. "Note that this does not confirm a table actually exists (or should exist), but returns the name that would be used if this table did exist."