using invoke instead of hookFor,
it works even outside the constructor of the generator.

Signed-off-by: Kamal Farsaoui <elfa.kamal@gmail.com>