DDC-2927: Pass parameters by constructor on load/create new entities #3687

doctrinebot opened this Issue Jan 21, 2014 · 0 comments

2 participants


Jira issue originally created by user jack88:

Unfortunately I found no possibility to pass parameters by constructor on load/create a entity?

I could realize it with live callbacks or through the event manager, but I think it is not a clean solution to configure objects with callbacks or event managers.

Is there a better way?

An example:

Offer-Entity contains a FeastDay-Service and can not exist without the existence of container object (composition). The composition can not be implemented on the database.

class Offer {
    protected $feastDayService = null;

    public function **construct(FeastDayService $service) {
        $this->feastDayService = $service;

    public function isOfferActive($date) {
        if(true === $this->feastDayService->isFeastDay($date) ) {
            return false;
                return true;
@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment