Permalink
Browse files

Merge pull request #453 from havvg/master

skip findPk alias on "@method" generation in Query
  • Loading branch information...
2 parents 441f969 + 4ded2e5 commit 1135e389a3de43304d60a9ba2796d1fbc2a23c49 @willdurand willdurand committed Aug 20, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 generator/lib/builder/om/QueryBuilder.php
@@ -143,6 +143,11 @@ protected function addClassOpen(&$script)
// magic findBy() methods, for IDE completion
foreach ($this->getTable()->getColumns() as $column) {
+ // skip "findPk" alias method
+ if (!$this->getTable()->hasCompositePrimaryKey() && $column->isPrimaryKey()) {
+ continue;
+ }
+
$script .= "
* @method $modelClass findOneBy" . $column->getPhpName() . "(" . $column->getPhpType() . " \$" . $column->getName() . ") Return the first $modelClass filtered by the " . $column->getName() . " column";
}

0 comments on commit 1135e38

Please sign in to comment.