Merge pull request #150 from qufo/patch-1

Update ModelsCommand.php , Add COMMENT info.
This commit is contained in:
Barry vd. Heuvel
2015-01-21 11:03:33 +01:00
+9 -4
View File
@@ -256,8 +256,8 @@ class ModelsCommand extends Command
}
}
$this->setProperty($name, $type, true, true);
$comment = $column->getComment();
$this->setProperty($name, $type, true, true,$comment);
$this->setMethod(
Str::camel("where_" . $name),
'\Illuminate\Database\Query\Builder|\\' . get_class($model),
@@ -361,8 +361,9 @@ class ModelsCommand extends Command
* @param string|null $type
* @param bool|null $read
* @param bool|null $write
* @param string|null $comment
*/
protected function setProperty($name, $type = null, $read = null, $write = null)
protected function setProperty($name, $type = null, $read = null, $write = null,$comment=null)
{
if (!isset($this->properties[$name])) {
$this->properties[$name] = array();
@@ -379,6 +380,9 @@ class ModelsCommand extends Command
if ($write !== null) {
$this->properties[$name]['write'] = $write;
}
if ($comment !== null ) {
$this->properties[$name]['comment'] = $comment;
}
}
protected function setMethod($name, $type = '', $arguments = array())
@@ -435,7 +439,8 @@ class ModelsCommand extends Command
} else {
$attr = 'property-read';
}
$tag = Tag::createInstance("@{$attr} {$property['type']} {$name}", $phpdoc);
$comment = isset($property['comment'])?$property['comment']:'';
$tag = Tag::createInstance("@{$attr} {$property['type']} {$name} {$comment}", $phpdoc);
$phpdoc->appendTag($tag);
}