/** * Enter description here... * * @param RM_Holder_iHolderable $obEntity * @param RM_Holder_Object $obDestinationHolder */ public function moveEntity(RM_Holder_iHolderable $obEntity, RM_Holder_Object $obDestinationHolder) { if ($obEntity->getHolder()->id() != $this->id) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ' : equipment in other holder'); } if (!isNull($obEntity->getInvoice())) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ' : equipment in invoice '); } return $this->_access($obDestinationHolder)->moveEntity($obEntity, $obDestinationHolder); }
/** * Add entity to exists invoice between holders or, if necessary, create new invloice and add entity * * @param RM_Holder_iHolderable $obEntity * @param RM_Holder_Object $obDestinationHolder * * @return bool */ public function moveEntity(RM_Holder_iHolderable $obEntity, RM_Holder_Object $obDestinationHolder) { $obInvoice = M('Holder')->getInvoiceBetweenHoldersOrCreate($obEntity->getHolder(), $obDestinationHolder); return $obInvoice->addEntity($obEntity); }