/** * Attach getGravatar method to Account. */ public function onContainerReady($event) { // attach method to Account ZMObject::attachMethod('getGravatar', 'ZenMagick\\StoreBundle\\Entity\\Account', array($this, 'getGravatar')); }