@@ -77,7 +77,7 @@ protected function execute($arguments = array(), $options = array())
77
77
$ code = file_get_contents ($ file );
78
78
79
79
// introspect the model without loading the class
80
- if (preg_match_all ('/@property (\w +) \$(\w+)/ ' , $ code , $ matches , PREG_SET_ORDER ))
80
+ if (preg_match_all ('/@property ([\w|\[\]] +) \$(\w+)/ ' , $ code , $ matches , PREG_SET_ORDER ))
81
81
{
82
82
$ properties = array ();
83
83
foreach ($ matches as $ match )
@@ -93,10 +93,14 @@ protected function execute($arguments = array(), $options = array())
93
93
foreach ($ properties as $ name => $ type )
94
94
{
95
95
$ camelized = sfInflector::camelize ($ name );
96
- $ collection = 'Doctrine_Collection ' == $ type ;
96
+ $ collection = strpos ( $ type , 'Doctrine_Collection ' , 0 ) === 0 ; // == $type;
97
97
98
- $ getters [] = sprintf ('@method %- ' .$ typePad .'s %s%- ' .($ namePad + 2 ).'s Returns the current record \'s "%s" %s ' , $ type , 'get ' , $ camelized .'() ' , $ name , $ collection ? 'collection ' : 'value ' );
99
- $ setters [] = sprintf ('@method %- ' .$ typePad .'s %s%- ' .($ namePad + 2 ).'s Sets the current record \'s "%s" %s ' , $ model , 'set ' , $ camelized .'() ' , $ name , $ collection ? 'collection ' : 'value ' );
98
+ // Adjust padding for new docblock:
99
+ // + 2 and +1: +2 for Paranthesis () and +1 for $
100
+ $ setMethodNameLength = $ namePad + 2 + $ namePad + 1 ;
101
+
102
+ $ getters [] = sprintf ('@method %- ' .$ typePad .'s %s%- ' .$ setMethodNameLength .'s Returns the current record \'s "%s" %s ' , $ type , 'get ' , $ camelized .'() ' , $ name , $ collection ? 'collection ' : 'value ' );
103
+ $ setters [] = sprintf ('@method %- ' .$ typePad .'s %s%- ' .$ setMethodNameLength .'s Sets the current record \'s "%s" %s ' , $ model , 'set ' , $ camelized .'($ ' .lcfirst ($ camelized ).') ' , $ name , $ collection ? 'collection ' : 'value ' );
100
104
}
101
105
102
106
// use the last match as a search string
0 commit comments