/** * Declares an association between this object and a Empresa object. * * @param Empresa $v * @return Tarea The current object (for fluent API support) * @throws PropelException */ public function setEmpresa(Empresa $v = null) { if ($v === null) { $this->setIdEmpresa(NULL); } else { $this->setIdEmpresa($v->getIdEmpresa()); } $this->aEmpresa = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Empresa object, it will not be re-added. if ($v !== null) { $v->addTarea($this); } return $this; }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Empresa $value A Empresa object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Empresa $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getIdEmpresa(); } // if key === null self::$instances[$key] = $obj; } }
/** * Desactivar Almacen */ public function testDesactivarAlmacen() { POSController::DropBd(); $usuario = UsuarioDAO::getAll(); if (sizeof($usuario) == 0) { Logger::error("WHOOOT no hay usuarios en la BD"); return; } $id_usuario = $usuario[0]->getIdUsuario(); @DireccionDAO::save($direccion = new Direccion(array("calle" => "Una Calle", "numero_exterior" => "322", "id_ciudad" => "12", "codigo_postal" => "38000", "ultima_modificacion" => "2012-02-21 22:10:45", "id_usuario_ultima_modificacion" => "2"))); @EmpresaDAO::save($empresa = new Empresa(array("id_direccion" => $direccion->getIdDireccion(), "rfc" => "RFC_" . time(), "razon_social" => "Empresa_Razon_Social__" . time(), "fecha_alta" => "2012-02-21 22:10:45", "activo" => 1, "direccion_web" => "Dir_" . time()))); @SucursalDAO::save($sucursal = new Sucursal(array("id_direccion" => $direccion->getIdDireccion(), "razon_social" => "Sucursal_Razon_Social__" . time(), "saldo_a_favor" => 2000, "fecha_apertura" => "2012-02-21 22:10:45", "activa" => 1))); $tipo_almacen = AlmacenesController::NuevoTipo("Nuevo_Tipo_Almacen___" . time()); Logger::log("Nuevo almacen"); $almacen = AlmacenesController::Nuevo($id_empresa = $empresa->getIdEmpresa(), $id_sucursal = $sucursal->getIdSucursal(), $id_tipo_almacen = $tipo_almacen["id_tipo_almacen"], $nombre = "Almacen_Editar" . time(), $descripcion = "Almacen de prueba_ " . time()); // Desactivamos el Almacen Logger::log("A desactivar almacen recien creado"); $almacen_desactivado = AlmacenesController::Desactivar($id_almacen = $almacen["id_almacen"]); $_almacen = AlmacenDAO::getByPK($almacen["id_almacen"]); $this->assertEquals(0, $_almacen->getActivo()); }