use ArrayObject;
use Galette\Events\GaletteEvent;
+use Galette\Features\HasEvent;
use Galette\Features\Socials;
use Throwable;
use Analog\Analog;
{
use Dynamics;
use Socials;
+ use HasEvent;
public const TABLE = 'adherents';
public const PK = 'id_adh';
}
}
+ $this
+ ->withAddEvent()
+ ->withEditEvent()
+ ->withoutDeleteEvent()
+ ->activateEvents();
+
if ($args == null || is_int($args)) {
if (is_int($args) && $args > 0) {
$this->load($args);
);
}
- $event = 'member.add';
+ $event = $this->getAddEventName();
} else {
$hist->add(_T("Fail to add new member."));
throw new \Exception(
$this->sname
);
}
- $event = 'member.edit';
+ $event = $this->getEditEventName();
}
//dynamic fields
$this->storeSocials($this->id);
//send event at the end of process, once all has been stored
- if ($event !== null) {
+ if ($event !== null && $this->areEventsEnabled()) {
$emitter->dispatch(new GaletteEvent($event, $this));
}
return true;
$this->loadParent();
return $this;
}
+
+ /**
+ * Get prefix for events
+ *
+ * @return string
+ */
+ protected function getEventsPrefix(): string
+ {
+ return 'member';
+ }
}