Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2927

Pass parameters by constructor on load/create new entities

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: ORM
    • Labels:
      None

      Description

      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;
              }
      }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Jacek Hensoldt
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: