@@ -77,7 +77,7 @@ protected function execute($arguments = array(), $options = array())
7777 $ code = file_get_contents ($ file );
7878
7979 // 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 ))
8181 {
8282 $ properties = array ();
8383 foreach ($ matches as $ match )
@@ -93,10 +93,14 @@ protected function execute($arguments = array(), $options = array())
9393 foreach ($ properties as $ name => $ type )
9494 {
9595 $ camelized = sfInflector::camelize ($ name );
96- $ collection = 'Doctrine_Collection ' == $ type ;
96+ $ collection = strpos ( $ type , 'Doctrine_Collection ' , 0 ) === 0 ; // == $type;
9797
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 ' );
100104 }
101105
102106 // use the last match as a search string
0 commit comments