zend framework2 - One Factory to create entities -
zend framework2 - One Factory to create entities -
i want utilize 1 mill create entities
$this->getservicemanager()->setfactory("order_entity", new orderentityfactory($obj->concept, $obj->currency, $obj->exchangerate, $obj->cost, $obj->percentageofpayment, $obj->accountid, $obj->invoiceid, $obj->paymentdate, $obj->orderstatus, $obj->categorylinknode)); $orderentity = $this->getservicemanager()->get("order_entity");
i order entity, if want set in loop , pass values other order entities error cant re declare, think that's obvious can set mill name created; how can create mill can reuse passing values parameter?
thanks!
i rather create mill kind of collection storing entities. instance,
$this->getservicemanager()->setfactory("order_entity_collection", function($servicelocator){ $collection = new \arrayobject(); foreach ($myentities $entity) { $collection[] = $entity; } homecoming $collection; });
you can add together new entities collection doing so,
$collection = $servicelocator->get('order_entity_collection'); foreach ($otherentities $entity) { $collection[] = $entity; }
zend-framework2
Comments
Post a Comment