/** * Eliminar un ObjetoEnInventario Dado el $objetoEnInventarioId * * @param $objetoEnInventarioId */ public function removeObjetoEnInventario($objetoEnInventarioId) { $objetoEnInventario = new ObjetoEnInventario(); $objetoEnInventario->setId($objetoEnInventarioId); # Validamos los campos if (!EntityValidator::validateId($objetoEnInventarioId)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 112); } # Verificamos que la entidad exista. if (!$this->objetoEnInventarioBean->getObjetoEnInventario($objetoEnInventario)) { throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 113); } # Verificamos que la entidad no esté siendo utilziada en alguna otra. # Eliminamos la entidad if (!$this->objetoEnInventarioBean->removeObjetoEnInventario($objetoEnInventario)) { throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_FAIL, $this->ID + 114); } }
public static function toEntity(ObjetoEnInventarioDTO $objetoEnInventarioDTO) { $objetoEnInventario = new ObjetoEnInventario(); $objetoEnInventario->setId($objetoEnInventarioDTO->getId()); $objetoEnInventario->setInventarioElemento($objetoEnInventarioDTO->getInventarioElemento()); $objetoEnInventario->setInventarioNumeroSerie($objetoEnInventarioDTO->getInventarioNumeroSerie()); $objetoEnInventario->setInventarioSalon($objetoEnInventarioDTO->getInventarioSalon()); $objetoEnInventario->setComputadora($objetoEnInventarioDTO->getComputadora()); return $objetoEnInventario; }
/** * Listar algunos Computadora dado el $computaoraObjetosInventarioId * * @param $computaoraObjetosInventarioId * @param $performSize * @param $firstResultNumber * @param $numResults */ public function listComputadorasByObjetoEnInventarioId($objetoEnInventarioId, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER) { $objBean = new ObjetoEnInventarioBean($this->persistenceManager); $obj = new ObjetoEnInventario(); $obj->setId($objetoEnInventarioId); # Validamos los campos if ($firstResultNumber !== null && !EntityValidator::validatePositiveNumber($firstResultNumber)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 261); } if (!EntityValidator::validateGlobalOrderPriority($orderPriority)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 263); } if (!EntityValidator::validateId($objetoEnInventarioId)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 265); } # Verificamos que la entidad exista if (!$objBean->getObjetoEnInventario($obj)) { throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 267); } # Listamos las entidades if ($performSize) { $this->lastRequestSize = $this->computadoraBean->countGetComputadorasByObjetoEnInventario($obj); } return ComputadoraDTO::loadFromEntities($this->computadoraBean->listComputadorasByObjetoEnInventario($obj, $firstResultNumber, $numResults, $orderBy, $orderPriority)); }