Compare commits

..
4 Commits
Author SHA1 Message Date
Barry vd. Heuvel 874cd4c1a2 Add prefix to table
Fixes #54
2014-01-29 16:24:09 +01:00
Barry vd. Heuvel 0dc098a7ba Merge pull request #47 from AoSiX/patch-1
Test if model class is instanciable
2013-12-17 03:04:30 -08:00
TANT Julien 7ee52d7e61 restore the try { statement 2013-12-17 11:53:02 +01:00
TANT Julien 430c5d7db4 Test if model class is instanciable
to handle abstract classes, interfaces...
2013-12-16 22:38:06 +01:00
@@ -141,7 +141,13 @@ class ModelsCommand extends Command {
$this->properties = array();
$this->methods = array();
if(class_exists($name)){
try{
try {
// handle abstract classes, interfaces, ...
$reflectionClass = new \ReflectionClass($name);
if (!$reflectionClass->IsInstantiable()) {
throw new \Exception($name . ' is not instanciable.');
}
$model = new $name();
$this->getPropertiesFromTable($model);
$this->getPropertiesFromMethods($model);
@@ -177,7 +183,7 @@ class ModelsCommand extends Command {
* @param \Illuminate\Database\Eloquent\Model $model
*/
protected function getPropertiesFromTable($model){
$table = $model->getTable();
$table = $model->getConnection()->getTablePrefix() . $model->getTable();
$schema = $model->getConnection()->getDoctrineSchemaManager($table);
$schema->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');