Skip to content

(Enhancement proposal) Delegate behavior and magic methods #449

Closed
grisha87 opened this Issue Aug 16, 2012 · 5 comments

4 participants

@grisha87

Hi there.

I've played a bit with the "delegate" behavior and found that the resulting class docblock is quite poor. I think it would be nice to generate some @method PHPDoc tags containing the information about magically delegated methods?

It strongly improves auto-completion in IDE's, and supporting this idea in Propel could be a great advantage.

Now it looks like this:

/**
 * Base class that represents a row from the 'income' table.
 *
 * @package    propel.generator.some.package
 */

And it could look like that:

/**
 * Base class that represents a row from the 'income' table.
 *
 * Methods delegated to the 'Transaction' class
 *
 * @method int borp() borp(int $int1, int $int2) multiply two integers:
 *
 * @package    propel.generator.treasurer.models.transaction.om
 */
@fzaninotto
Propel member

Except that if you change the delegate class, the @method lines won't change automatically until you regenerate your model. Not very user-friendly...

@jaugustin
Propel member

@fzaninotto or never because, the @method ... will be generated only for generated method not for user custom methods, or we will have to use reflection on classes with base classes not generated or maybe outdated.

@fzaninotto
Propel member

Using reflection is the best solution IMHO (no performance problem since it's achieved at buildtime), but as I said, the phpDoc gets outdated as soon as the user touches the stub class after a generation. The WTF effect might exceed the benefit.

@grisha87
grisha87 commented Sep 4, 2012

@fzaninotto So maybe it should it optional (by behavior's parameter)? I think that if it would be denoted in the docs, it won't be such a problem and I consider "missing method" IDE warnings a bigger problem that an outdated phpDoc comment that I should have refresh by running propel-gen om.

@jaugustin I agree on using the reflection at buildtime, probably best approach possible probably

@willdurand
Propel member

I would vote -1 on this, it's too much work and new things to maintain. It's more a feature for Propel2.

@willdurand willdurand closed this Dec 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.