Skip to content

Commit 2d344fa

Browse files
committed
Revert "Improved generated typehints for doctrine model classes."
This reverts commit cd4243d.
1 parent cd4243d commit 2d344fa

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -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,14 +93,10 @@ protected function execute($arguments = array(), $options = array())
9393
foreach ($properties as $name => $type)
9494
{
9595
$camelized = sfInflector::camelize($name);
96-
$collection = strpos($type, 'Doctrine_Collection', 0) === 0;// == $type;
96+
$collection = 'Doctrine_Collection' == $type;
9797

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');
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');
104100
}
105101

106102
// use the last match as a search string

0 commit comments

Comments
 (0)