lba/lib/model/om alba/test alba/test/bootstrap alba/web alba/web/css alba/web/errors dist Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <[email protected]> Date: Wed, 28 Feb 2007 17:22:46 -0300 (ART) X-pressenter_com_ar-MailScanner: Found to be clean X-pressenter_com_ar-MailScanner-From: [email protected] Author: ftoledo Date: 2007-02-28 17:20:23 -0300 (Wed, 28 Feb 2007) New Revision: 4346 Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/sinciclolectivoSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/default/actions/ prosistem/alba/trunk/alba/plugins/ prosistem/alba/trunk/alba/symfony prosistem/alba/trunk/alba/symfony.bat prosistem/alba/trunk/alba/symfony.php prosistem/alba/trunk/alba/test/bootstrap/ prosistem/alba/trunk/alba/test/bootstrap/functional.php prosistem/alba/trunk/alba/test/bootstrap/unit.php prosistem/alba/trunk/alba/web/errors/ prosistem/alba/trunk/alba/web/errors/error500.php Removed: prosistem/alba/trunk/alba/SYMFONY prosistem/alba/trunk/alba/lib/pake prosistem/alba/trunk/alba/lib/phing prosistem/alba/trunk/alba/symfony.sh Modified: prosistem/alba/trunk/alba/apps/principal/config/cache.yml prosistem/alba/trunk/alba/apps/principal/config/config.php prosistem/alba/trunk/alba/apps/principal/config/filters.yml prosistem/alba/trunk/alba/apps/principal/config/i18n.yml prosistem/alba/trunk/alba/apps/principal/config/logging.yml prosistem/alba/trunk/alba/apps/principal/config/settings.yml prosistem/alba/trunk/alba/apps/principal/config/view.yml prosistem/alba/trunk/alba/apps/principal/modules/actividad/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/listSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/anio/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/boletin/config/view.yml prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/_horarioMaterias.php prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/busquedaDocenteSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/indexSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/agregarTurnosYPeriodosSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/cuenta/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/cuenta/templates/verCompletaSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/division/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/escalanota/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/feriado/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_fin.php prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_inicio.php prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarFormSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/boletinFormularioSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosBusquedaFormularioSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosFormularioSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoPrimariaFormularioSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/constanciaAlumnoRegularFormularioSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/solicitudLegajoBusquedaFormularioSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/config/view.yml prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/editSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/verLegajoSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/provincia/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/relAlumnoDivision/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/editSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/listSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php prosistem/alba/trunk/alba/apps/principal/modules/seguridad/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/seguridad/templates/_login.php prosistem/alba/trunk/alba/apps/principal/modules/tipodocumento/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/turnos/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_fin.php prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_inicio.php prosistem/alba/trunk/alba/apps/principal/modules/turnos/validate/edit.yml prosistem/alba/trunk/alba/apps/principal/modules/usuario/config/generator.yml prosistem/alba/trunk/alba/apps/principal/modules/usuario/templates/editSuccess.php prosistem/alba/trunk/alba/apps/principal/templates/layout.php prosistem/alba/trunk/alba/config/config.php prosistem/alba/trunk/alba/config/schema.xml prosistem/alba/trunk/alba/lib/model/Actividad.php prosistem/alba/trunk/alba/lib/model/ActividadPeer.php prosistem/alba/trunk/alba/lib/model/Adjunto.php prosistem/alba/trunk/alba/lib/model/AdjuntoPeer.php prosistem/alba/trunk/alba/lib/model/Alumno.php prosistem/alba/trunk/alba/lib/model/AlumnoPeer.php prosistem/alba/trunk/alba/lib/model/Anio.php prosistem/alba/trunk/alba/lib/model/AnioPeer.php prosistem/alba/trunk/alba/lib/model/Asistencia.php prosistem/alba/trunk/alba/lib/model/AsistenciaPeer.php prosistem/alba/trunk/alba/lib/model/BoletinActividades.php prosistem/alba/trunk/alba/lib/model/BoletinActividadesPeer.php prosistem/alba/trunk/alba/lib/model/BoletinConceptual.php prosistem/alba/trunk/alba/lib/model/BoletinConceptualPeer.php prosistem/alba/trunk/alba/lib/model/Calendariovacunacion.php prosistem/alba/trunk/alba/lib/model/CalendariovacunacionPeer.php prosistem/alba/trunk/alba/lib/model/Cargobaja.php prosistem/alba/trunk/alba/lib/model/CargobajaPeer.php prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php prosistem/alba/trunk/alba/lib/model/CiclolectivoPeer.php prosistem/alba/trunk/alba/lib/model/Concepto.php prosistem/alba/trunk/alba/lib/model/ConceptoPeer.php prosistem/alba/trunk/alba/lib/model/Conceptobaja.php prosistem/alba/trunk/alba/lib/model/ConceptobajaPeer.php prosistem/alba/trunk/alba/lib/model/Cuenta.php prosistem/alba/trunk/alba/lib/model/CuentaPeer.php prosistem/alba/trunk/alba/lib/model/Distritoescolar.php prosistem/alba/trunk/alba/lib/model/DistritoescolarPeer.php prosistem/alba/trunk/alba/lib/model/Division.php prosistem/alba/trunk/alba/lib/model/DivisionPeer.php prosistem/alba/trunk/alba/lib/model/Docente.php prosistem/alba/trunk/alba/lib/model/DocenteHorario.php prosistem/alba/trunk/alba/lib/model/DocenteHorarioPeer.php prosistem/alba/trunk/alba/lib/model/DocentePeer.php prosistem/alba/trunk/alba/lib/model/Escalanota.php prosistem/alba/trunk/alba/lib/model/EscalanotaPeer.php prosistem/alba/trunk/alba/lib/model/Espacio.php prosistem/alba/trunk/alba/lib/model/EspacioPeer.php prosistem/alba/trunk/alba/lib/model/Establecimiento.php prosistem/alba/trunk/alba/lib/model/EstablecimientoPeer.php prosistem/alba/trunk/alba/lib/model/Examen.php prosistem/alba/trunk/alba/lib/model/ExamenPeer.php prosistem/alba/trunk/alba/lib/model/Feriado.php prosistem/alba/trunk/alba/lib/model/FeriadoPeer.php prosistem/alba/trunk/alba/lib/model/Horarioescolar.php prosistem/alba/trunk/alba/lib/model/HorarioescolarPeer.php prosistem/alba/trunk/alba/lib/model/Horarioescolartipo.php prosistem/alba/trunk/alba/lib/model/HorarioescolartipoPeer.php prosistem/alba/trunk/alba/lib/model/Legajoadjunto.php prosistem/alba/trunk/alba/lib/model/LegajoadjuntoPeer.php prosistem/alba/trunk/alba/lib/model/Legajocategoria.php prosistem/alba/trunk/alba/lib/model/LegajocategoriaPeer.php prosistem/alba/trunk/alba/lib/model/Legajopedagogico.php prosistem/alba/trunk/alba/lib/model/LegajopedagogicoPeer.php prosistem/alba/trunk/alba/lib/model/Locacion.php prosistem/alba/trunk/alba/lib/model/LocacionPeer.php prosistem/alba/trunk/alba/lib/model/Menu.php prosistem/alba/trunk/alba/lib/model/MenuPeer.php prosistem/alba/trunk/alba/lib/model/Modulo.php prosistem/alba/trunk/alba/lib/model/ModuloPeer.php prosistem/alba/trunk/alba/lib/model/Niveltipo.php prosistem/alba/trunk/alba/lib/model/NiveltipoPeer.php prosistem/alba/trunk/alba/lib/model/Organizacion.php prosistem/alba/trunk/alba/lib/model/OrganizacionPeer.php prosistem/alba/trunk/alba/lib/model/Pais.php prosistem/alba/trunk/alba/lib/model/PaisPeer.php prosistem/alba/trunk/alba/lib/model/Periodo.php prosistem/alba/trunk/alba/lib/model/PeriodoPeer.php prosistem/alba/trunk/alba/lib/model/Permiso.php prosistem/alba/trunk/alba/lib/model/PermisoPeer.php prosistem/alba/trunk/alba/lib/model/Preferencia.php prosistem/alba/trunk/alba/lib/model/PreferenciaPeer.php prosistem/alba/trunk/alba/lib/model/Provincia.php prosistem/alba/trunk/alba/lib/model/ProvinciaPeer.php prosistem/alba/trunk/alba/lib/model/RelActividadDocente.php prosistem/alba/trunk/alba/lib/model/RelActividadDocentePeer.php prosistem/alba/trunk/alba/lib/model/RelAlumnoDivision.php prosistem/alba/trunk/alba/lib/model/RelAlumnoDivisionPeer.php prosistem/alba/trunk/alba/lib/model/RelAnioActividad.php prosistem/alba/trunk/alba/lib/model/RelAnioActividadPeer.php prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumno.php prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumnoPeer.php prosistem/alba/trunk/alba/lib/model/RelDivisionActividad.php prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocente.php prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocentePeer.php prosistem/alba/trunk/alba/lib/model/RelDivisionActividadPeer.php prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimiento.php prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimientoPeer.php prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacion.php prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacionPeer.php prosistem/alba/trunk/alba/lib/model/RelLocacionEspacio.php prosistem/alba/trunk/alba/lib/model/RelLocacionEspacioPeer.php prosistem/alba/trunk/alba/lib/model/RelNivelLocacion.php prosistem/alba/trunk/alba/lib/model/RelNivelLocacionPeer.php prosistem/alba/trunk/alba/lib/model/RelRolPermiso.php prosistem/alba/trunk/alba/lib/model/RelRolPermisoPeer.php prosistem/alba/trunk/alba/lib/model/RelUsuarioPermiso.php prosistem/alba/trunk/alba/lib/model/RelUsuarioPermisoPeer.php prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferencia.php prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferenciaPeer.php prosistem/alba/trunk/alba/lib/model/Repeticion.php prosistem/alba/trunk/alba/lib/model/RepeticionPeer.php prosistem/alba/trunk/alba/lib/model/Responsable.php prosistem/alba/trunk/alba/lib/model/ResponsablePeer.php prosistem/alba/trunk/alba/lib/model/Rol.php prosistem/alba/trunk/alba/lib/model/RolPeer.php prosistem/alba/trunk/alba/lib/model/Tipoasistencia.php prosistem/alba/trunk/alba/lib/model/TipoasistenciaPeer.php prosistem/alba/trunk/alba/lib/model/Tipodocente.php prosistem/alba/trunk/alba/lib/model/TipodocentePeer.php prosistem/alba/trunk/alba/lib/model/Tipodocumento.php prosistem/alba/trunk/alba/lib/model/TipodocumentoPeer.php prosistem/alba/trunk/alba/lib/model/Tipoespacio.php prosistem/alba/trunk/alba/lib/model/TipoespacioPeer.php prosistem/alba/trunk/alba/lib/model/Tipoiva.php prosistem/alba/trunk/alba/lib/model/TipoivaPeer.php prosistem/alba/trunk/alba/lib/model/Tipolocacion.php prosistem/alba/trunk/alba/lib/model/TipolocacionPeer.php prosistem/alba/trunk/alba/lib/model/Turnos.php prosistem/alba/trunk/alba/lib/model/TurnosPeer.php prosistem/alba/trunk/alba/lib/model/Usuario.php prosistem/alba/trunk/alba/lib/model/UsuarioPeer.php prosistem/alba/trunk/alba/lib/model/map/ActividadMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/AdjuntoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/AlumnoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/AnioMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/AsistenciaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/BoletinActividadesMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/BoletinConceptualMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/CalendariovacunacionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/CargobajaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/CiclolectivoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/ConceptoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/ConceptobajaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/CuentaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/DistritoescolarMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/DivisionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/DocenteMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/EscalanotaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/EspacioMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/EstablecimientoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/ExamenMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/FeriadoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/HorarioescolartipoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/LegajoadjuntoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/LegajocategoriaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/LegajopedagogicoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/LocacionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/MenuMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/ModuloMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/NiveltipoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/OrganizacionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/PaisMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/PeriodoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/PermisoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/PreferenciaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/ProvinciaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelActividadDocenteMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelAlumnoDivisionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelAnioActividadMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelCalendariovacunacionAlumnoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelDivisionActividadDocenteMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelDocenteEstablecimientoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelEstablecimientoLocacionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelRolPermisoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPermisoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPreferenciaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RepeticionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/ResponsableMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/RolMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TipoasistenciaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TipodocenteMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TipodocumentoMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TipoespacioMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TipoivaMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TipolocacionMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/TurnosMapBuilder.php prosistem/alba/trunk/alba/lib/model/map/UsuarioMapBuilder.php prosistem/alba/trunk/alba/lib/model/om/BaseActividad.php prosistem/alba/trunk/alba/lib/model/om/BaseActividadPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseAdjunto.php prosistem/alba/trunk/alba/lib/model/om/BaseAdjuntoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseAlumno.php prosistem/alba/trunk/alba/lib/model/om/BaseAlumnoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseAnio.php prosistem/alba/trunk/alba/lib/model/om/BaseAnioPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseAsistencia.php prosistem/alba/trunk/alba/lib/model/om/BaseAsistenciaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividades.php prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividadesPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptual.php prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptualPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacion.php prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseCargobaja.php prosistem/alba/trunk/alba/lib/model/om/BaseCargobajaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivo.php prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseConcepto.php prosistem/alba/trunk/alba/lib/model/om/BaseConceptoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseConceptobaja.php prosistem/alba/trunk/alba/lib/model/om/BaseConceptobajaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseCuenta.php prosistem/alba/trunk/alba/lib/model/om/BaseCuentaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolar.php prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolarPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseDivision.php prosistem/alba/trunk/alba/lib/model/om/BaseDivisionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseDocentePeer.php prosistem/alba/trunk/alba/lib/model/om/BaseEscalanota.php prosistem/alba/trunk/alba/lib/model/om/BaseEscalanotaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseEspacio.php prosistem/alba/trunk/alba/lib/model/om/BaseEspacioPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimiento.php prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimientoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseExamen.php prosistem/alba/trunk/alba/lib/model/om/BaseExamenPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseFeriado.php prosistem/alba/trunk/alba/lib/model/om/BaseFeriadoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolarPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipo.php prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjunto.php prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjuntoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoria.php prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoriaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogico.php prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogicoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseLocacion.php prosistem/alba/trunk/alba/lib/model/om/BaseLocacionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseMenu.php prosistem/alba/trunk/alba/lib/model/om/BaseMenuPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseModulo.php prosistem/alba/trunk/alba/lib/model/om/BaseModuloPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipo.php prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacion.php prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacionPeer.php prosistem/alba/trunk/alba/lib/model/om/BasePais.php prosistem/alba/trunk/alba/lib/model/om/BasePaisPeer.php prosistem/alba/trunk/alba/lib/model/om/BasePeriodo.php prosistem/alba/trunk/alba/lib/model/om/BasePeriodoPeer.php prosistem/alba/trunk/alba/lib/model/om/BasePermiso.php prosistem/alba/trunk/alba/lib/model/om/BasePermisoPeer.php prosistem/alba/trunk/alba/lib/model/om/BasePreferencia.php prosistem/alba/trunk/alba/lib/model/om/BasePreferenciaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseProvincia.php prosistem/alba/trunk/alba/lib/model/om/BaseProvinciaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocente.php prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocentePeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivision.php prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivisionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividad.php prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividadPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumno.php prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividad.php prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocente.php prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocentePeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimiento.php prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimientoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacion.php prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacio.php prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacioPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacion.php prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermiso.php prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermisoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermiso.php prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermisoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferencia.php prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferenciaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php prosistem/alba/trunk/alba/lib/model/om/BaseRepeticionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseResponsable.php prosistem/alba/trunk/alba/lib/model/om/BaseResponsablePeer.php prosistem/alba/trunk/alba/lib/model/om/BaseRol.php prosistem/alba/trunk/alba/lib/model/om/BaseRolPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistencia.php prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistenciaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTipodocente.php prosistem/alba/trunk/alba/lib/model/om/BaseTipodocentePeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumento.php prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumentoPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacio.php prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacioPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTipoiva.php prosistem/alba/trunk/alba/lib/model/om/BaseTipoivaPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacion.php prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacionPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseTurnos.php prosistem/alba/trunk/alba/lib/model/om/BaseTurnosPeer.php prosistem/alba/trunk/alba/lib/model/om/BaseUsuario.php prosistem/alba/trunk/alba/lib/model/om/BaseUsuarioPeer.php prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividad.php prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividadPeer.php prosistem/alba/trunk/alba/web/css/main.css prosistem/alba/trunk/dist/symfony Log: upgrade del framework a symfony 1.0 stable fixes varios (estilos, warnings y configuraciones) Deleted: prosistem/alba/trunk/alba/SYMFONY =================================================================== Modified: prosistem/alba/trunk/alba/apps/principal/config/cache.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/cache.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/cache.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ default: - activate: off - type: slot + enabled: off + with_layout: false lifetime: 86400 Modified: prosistem/alba/trunk/alba/apps/principal/config/config.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/config.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/config.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,87 +1,8 @@ <?php -// symfony directories -if (is_readable(SF_ROOT_DIR.'/lib/symfony/symfony.php')) -{ - // symlink exists - $sf_symfony_lib_dir = SF_ROOT_DIR.'/lib/symfony'; - $sf_symfony_data_dir = SF_ROOT_DIR.'/data/symfony'; - $sf_version = '@DEV@'; -} -else -{ - // PEAR config - if ((include('symfony/pear.php')) != 'OK') - { - throw new Exception('Unable to find symfony librairies'); - } -} +// include project configuration +include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); -require_once($sf_symfony_lib_dir.'/config/sfConfig.class.php'); - -sfConfig::add(array( - 'sf_root_dir' => SF_ROOT_DIR, - 'sf_app' => SF_APP, - 'sf_environment' => SF_ENVIRONMENT, - 'sf_debug' => SF_DEBUG, - 'sf_symfony_lib_dir' => $sf_symfony_lib_dir, - 'sf_symfony_data_dir' => $sf_symfony_data_dir, - 'sf_test' => false, - 'sf_version' => $sf_version, -)); - -// start timer -if (sfConfig::get('sf_debug')) -{ - sfConfig::set('sf_timer_start', microtime(true)); -} - -// directory layout -include($sf_symfony_data_dir.'/config/constants.php'); - -// include path -set_include_path( - sfConfig::get('sf_lib_dir').PATH_SEPARATOR. - sfConfig::get('sf_app_lib_dir').PATH_SEPARATOR. - sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'vendor'.PATH_SEPARATOR. - get_include_path() -); - -// check to see if we're not in a cache cleaning process -require_once(sfConfig::get('sf_symfony_lib_dir').'/util/sfToolkit.class.php'); -if (sfToolkit::hasLockFile(SF_ROOT_DIR.DIRECTORY_SEPARATOR.SF_APP.'_'.SF_ENVIRONMENT.'.lck', 5)) -{ - // application is not yet available - include(SF_WEB_DIR.'/unavailable.html'); - die(1); -} - -// require project configuration -require_once(sfConfig::get('sf_config_dir').'/config.php'); - -// recent symfony update? -$version = @file_get_contents(sfConfig::get('sf_config_cache_dir').'/VERSION'); -if ($version != $sf_version) -{ - // force cache regeneration - foreach (array(sfConfig::get('sf_config_cache_dir').'/config_bootstrap_compile.yml.php', sfConfig::get('sf_config_cache_dir').'/config_core_compile.yml.php') as $file) - { - if (is_readable($file)) - { - unlink($file); - } - } -} - -// go -$bootstrap = sfConfig::get('sf_config_cache_dir').'/config_bootstrap_compile.yml.php'; -if (is_readable($bootstrap)) -{ - sfConfig::set('sf_in_bootstrap', true); - require_once($bootstrap); -} -else -{ - require_once(sfConfig::get('sf_symfony_lib_dir').'/symfony.php'); -} -?> \ No newline at end of file +// symfony bootstraping +require_once($sf_symfony_lib_dir.'/util/sfCore.class.php'); +sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir); Modified: prosistem/alba/trunk/alba/apps/principal/config/filters.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/filters.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/filters.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,8 @@ +rendering: ~ +web_debug: ~ +security: ~ + +# generally, you will want to insert your own filters here # filtro par conectar en utf8 al servidor de bases de datos(mysql) albaUtf8ConnectionFilter: @@ -2,2 +7,7 @@ class: albaUtf8ConnectionFilter - activate: on \ No newline at end of file + activate: on + +cache: ~ +common: ~ +flash: ~ +execution: ~ Modified: prosistem/alba/trunk/alba/apps/principal/config/i18n.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/i18n.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/i18n.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ all: default_culture: es - debug: on + debug: off \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/config/logging.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/logging.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/logging.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,13 +1,13 @@ prod: - active: off + enabled: off level: err dev: - active: on + enabled: on level: debug test: all: -# active: on +# enabled: on # level: debug Modified: prosistem/alba/trunk/alba/apps/principal/config/settings.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/settings.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/settings.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -12,7 +12,7 @@ stats: off no_script_name: off etag: off - i18n: off + i18n: on test: .settings: # E_ALL | E_STRICT & ~E_NOTICE = 2047 @@ -88,7 +88,7 @@ # # use_flash: on # -# activated_modules: [default] +# enabled_modules: [default] # # strip_comments: off # Modified: prosistem/alba/trunk/alba/apps/principal/config/view.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/view.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/config/view.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -9,7 +9,7 @@ keywords: alba, proyecto, software libre, educacion language: es - stylesheets: [ /sf/css/sf_admin/main, main] + stylesheets: [ %SF_ADMIN_WEB_DIR%/css/main, main] javascripts: [jsmenu/JSCookMenu] Modified: prosistem/alba/trunk/alba/apps/principal/modules/actividad/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/actividad/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/actividad/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -36,7 +36,7 @@ $this->vista = $this->getRequestParameter('vista'); } - protected function addFiltersCriteria (&$c) { + protected function addFiltersCriteria ($c) { $c->add(ActividadPeer::FK_ESTABLECIMIENTO_ID,$this->getUser()->getAttribute('fk_establecimiento_id')); } @@ -45,7 +45,7 @@ $actividad->setFkEstablecimientoId($this->getUser()->getAttribute('fk_establecimiento_id')); $actividad->save(); } - protected function addSortCriteria (&$c) { + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'nombre', 'sf_admin/actividad/sort')) { $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column); if ($this->getUser()->getAttribute('type', 'asc', 'sf_admin/actividad/sort') == 'asc') { Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -65,7 +65,7 @@ $alumno->save(); } - protected function addFiltersCriteria(&$c) { + protected function addFiltersCriteria($c) { $c->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID,$this->getUser()->getAttribute('fk_establecimiento_id')); if(isset($this->filters['nombre_apellido']) && $this->filters['nombre_apellido'] != '') { @@ -86,7 +86,7 @@ } - protected function addSortCriteria (&$c) { + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'apellido', 'sf_admin/alumno/sort')) { $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column); if ($this->getUser()->getAttribute('type', 'asc', 'sf_admin/alumno/sort') == 'asc') { @@ -132,8 +132,8 @@ else { // add javascripts - $this->getResponse()->addJavascript('/sf/js/prototype/prototype'); - $this->getResponse()->addJavascript('/sf/js/sf_admin/collapse'); + $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype'); + $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir').'/js/collapse'); if ($this->getRequestParameter('fk_cuenta_id')) $this->alumno->setFkCuentaId($this->getRequestParameter('fk_cuenta_id')); Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,380 +1,365 @@ -<?php - if(isset($datosCuenta) and $datosCuenta) { -?> +<?php if(isset($datosCuenta) and $datosCuenta): ?> <script type="text/javascript"> -function completaDatos() -{ -var datosCuenta = new Array() -datosCuenta [0] = "<?=$datosCuenta->getDireccion()?>" -datosCuenta [1] = "<?=$datosCuenta->getCiudad()?>" -datosCuenta [2] = "<?=$datosCuenta->getFkProvinciaId()?>" -datosCuenta [3] = "<?=$datosCuenta->getCodigoPostal()?>" -datosCuenta [4] = "<?=$datosCuenta->getTelefono()?>" -document.getElementsByName("alumno[direccion]")[0].value = datosCuenta[0] -document.getElementsByName("alumno[ciudad]")[0].value = datosCuenta[1] -document.getElementsByName("alumno[fk_provincia_id]")[0].value = datosCuenta[2] -document.getElementsByName("alumno[codigo_postal]")[0].value = datosCuenta[3] -document.getElementsByName("alumno[telefono]")[0].value = datosCuenta[4] -} -</script> -<? + function completaDatos() + { + var datosCuenta = new Array() + datosCuenta [0] = "<?=$datosCuenta->getDireccion()?>" + datosCuenta [1] = "<?=$datosCuenta->getCiudad()?>" + datosCuenta [2] = "<?=$datosCuenta->getFkProvinciaId()?>" + datosCuenta [3] = "<?=$datosCuenta->getCodigoPostal()?>" + datosCuenta [4] = "<?=$datosCuenta->getTelefono()?>" + document.getElementsByName("alumno[direccion]")[0].value = datosCuenta[0] + document.getElementsByName("alumno[ciudad]")[0].value = datosCuenta[1] + document.getElementsByName("alumno[fk_provincia_id]")[0].value = datosCuenta[2] + document.getElementsByName("alumno[codigo_postal]")[0].value = datosCuenta[3] + document.getElementsByName("alumno[telefono]")[0].value = datosCuenta[4] } -?> +</script> +<?php endif;?> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> -<h1><?php echo __(' ', -array()) ?></h1> +<h1><?php echo __(' ',array()) ?></h1> +<div id="sf_admin_container"> + <div id="sf_admin_header"> + <?php include_partial('alumno/edit_header', array('alumno' => $alumno)) ?> + </div> -<div id="sf_admin_header"> -<?php include_partial('alumno/edit_header', array('alumno' => $alumno)) ?> -</div> - <div id="sf_admin_content"> - -<?php if ($sf_request->hasErrors()): ?> -<div class="form-errors"> -<h2><?php echo __('There are some errors that prevent the form to validate') ?></h2> -<ul> -<?php foreach ($sf_request->getErrorNames() as $name): ?> - <li><?php echo $sf_request->getError($name) ?></li> -<?php endforeach; ?> -</ul> -</div> -<?php elseif ($sf_flash->has('notice')): ?> -<div class="save-ok"> -<h2><?php echo __($sf_flash->get('notice')) ?></h2> -</div> -<?php endif; ?> - -<?php echo form_tag('alumno/edit', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?> - -<?php echo object_input_hidden_tag($alumno, 'getId') ?> - -<fieldset id="sf_fieldset_informacion_general" class=""> -<h2><?php echo __('Informacion general') ?></h2> - -<div class="form-row"> - <?php echo label_for('alumno[apellido]', __('Apellido:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{apellido}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{apellido}')): ?> - <?php echo form_error('alumno{apellido}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> - - <?php echo object_input_tag($alumno, 'getApellido', array ( - 'size' => 64, - 'control_name' => 'alumno[apellido]', -)) ?> + <?php if ($sf_request->hasErrors()): ?> + <div class="form-errors"> + <h2><?php echo __('There are some errors that prevent the form to validate') ?></h2> + <ul> + <?php foreach ($sf_request->getErrorNames() as $name): ?> + <li><?php echo $sf_request->getError($name) ?></li> + <?php endforeach; ?> + </ul> </div> -</div> - -<div class="form-row"> - <?php echo label_for('alumno[nombre]', __('Nombres:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{nombre}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{nombre}')): ?> - <?php echo form_error('alumno{nombre}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> - - <?php echo object_input_tag($alumno, 'getNombre', array ( - 'size' => 64, - 'control_name' => 'alumno[nombre]', -)) ?> + <?php elseif ($sf_flash->has('notice')): ?> + <div class="save-ok"> + <h2><?php echo __($sf_flash->get('notice')) ?></h2> </div> -</div> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[sexo]', __('Sexo:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{sexo}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{sexo}')): ?> - <?php echo form_error('alumno{sexo}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo form_tag('alumno/edit', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?> + <?php echo object_input_hidden_tag($alumno, 'getId') ?> - <?php echo include_partial('sexo', array('type' => 'edit', 'alumno' => $alumno)) ?> - </div> -</div> + <fieldset id="sf_fieldset_informacion_general" class=""> + <h2><?php echo __('Informacion general') ?></h2> -<div class="form-row"> - <?php echo label_for('alumno[fk_tipodocumento_id]', __('Tipo de Documento:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{fk_tipodocumento_id}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{fk_tipodocumento_id}')): ?> - <?php echo form_error('alumno{fk_tipodocumento_id}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[apellido]', __('Apellido:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{apellido}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{apellido}')): ?> + <?php echo form_error('alumno{apellido}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_select_tag($alumno, 'getFkTipodocumentoId', array ( - 'related_class' => 'Tipodocumento', - 'control_name' => 'alumno[fk_tipodocumento_id]', -)) ?> - </div> -</div> + <?php echo object_input_tag($alumno, 'getApellido', array ( + 'size' => 64, + 'control_name' => 'alumno[apellido]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[nro_documento]', __('Nro. Documento:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{nro_documento}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{nro_documento}')): ?> - <?php echo form_error('alumno{nro_documento}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[nombre]', __('Nombres:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{nombre}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{nombre}')): ?> + <?php echo form_error('alumno{nombre}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_input_tag($alumno, 'getNroDocumento', array ( - 'size' => 16, - 'control_name' => 'alumno[nro_documento]', -)) ?> - </div> -</div> + <?php echo object_input_tag($alumno, 'getNombre', array ( + 'size' => 64, + 'control_name' => 'alumno[nombre]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[lugar_nacimiento]', __('Lugar de Nacimiento:'), '') ?> - <div class="content<?php if ($sf_request->hasError('alumno{lugar_nacimiento}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{lugar_nacimiento}')): ?> - <?php echo form_error('alumno{lugar_nacimiento}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[sexo]', __('Sexo:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{sexo}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{sexo}')): ?> + <?php echo form_error('alumno{sexo}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_input_tag($alumno, 'getLugarNacimiento', array ( - 'size' => 20, - 'control_name' => 'alumno[lugar_nacimiento]', -)) ?> - </div> -</div> + <?php echo include_partial('sexo', array('type' => 'edit', 'alumno' => $alumno)) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[fecha_nacimiento]', __('Fecha Nacimiento:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{fecha_nacimiento}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{fecha_nacimiento}')): ?> - <?php echo form_error('alumno{fecha_nacimiento}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[fk_tipodocumento_id]', __('Tipo de Documento:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{fk_tipodocumento_id}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{fk_tipodocumento_id}')): ?> + <?php echo form_error('alumno{fk_tipodocumento_id}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_input_date_tag($alumno, 'getFechaNacimiento', array ( - 'rich' => true, - 'withtime' => true, - 'calendar_button_img' => '/sf/images/sf_admin/date.png', - 'control_name' => 'alumno[fecha_nacimiento]', -)) ?> - </div> -</div> + <?php echo object_select_tag($alumno, 'getFkTipodocumentoId', array ( + 'related_class' => 'Tipodocumento', + 'control_name' => 'alumno[fk_tipodocumento_id]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[fk_pais_id]', __('Nacionalidad:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{fk_pais_id}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{fk_pais_id}')): ?> - <?php echo form_error('alumno{fk_pais_id}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[nro_documento]', __('Nro. Documento:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{nro_documento}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{nro_documento}')): ?> + <?php echo form_error('alumno{nro_documento}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_select_tag($alumno, 'getFkPaisId', array ( - 'related_class' => 'Pais', - 'control_name' => 'alumno[fk_pais_id]', -)) ?> - </div> -</div> + <?php echo object_input_tag($alumno, 'getNroDocumento', array ( + 'size' => 16, + 'control_name' => 'alumno[nro_documento]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[email]', __('Email:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{email}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{email}')): ?> - <?php echo form_error('alumno{email}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[lugar_nacimiento]', __('Lugar de Nacimiento:'), '') ?> + <div class="content<?php if ($sf_request->hasError('alumno{lugar_nacimiento}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{lugar_nacimiento}')): ?> + <?php echo form_error('alumno{lugar_nacimiento}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_input_tag($alumno, 'getEmail', array ( - 'size' => 64, - 'control_name' => 'alumno[email]', -)) ?> - </div> -</div> + <?php echo object_input_tag($alumno, 'getLugarNacimiento', array ( + 'size' => 20, + 'control_name' => 'alumno[lugar_nacimiento]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[activo]', __('¿Está activo?:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{activo}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{activo}')): ?> - <?php echo form_error('alumno{activo}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[fecha_nacimiento]', __('Fecha Nacimiento:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{fecha_nacimiento}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{fecha_nacimiento}')): ?> + <?php echo form_error('alumno{fecha_nacimiento}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_checkbox_tag($alumno, 'getActivo', array ( - 'control_name' => 'alumno[activo]', -)) ?> - </div> -</div> + <?php echo object_input_date_tag($alumno, 'getFechaNacimiento', array ( + 'rich' => true, + 'withtime' => true, + 'calendar_button_img' => sfConfig::get('sf_admin_web_dir').'/images/date.png', + 'control_name' => 'alumno[fecha_nacimiento]', + )) ?> + </div> + </div> -</fieldset> -<fieldset id="sf_fieldset_donde_vive" class=""> -<h2><?php echo __('Donde vive') ?></h2> -<br> -<?php - if(isset($datosCuenta) and $datosCuenta) { - echo button_to("Cargar datos de la cuenta", "#", array("class" => "sf_admin_action_sava", "onClick" => "javascript:completaDatos()")); - } -?> + <div class="form-row"> + <?php echo label_for('alumno[fk_pais_id]', __('Nacionalidad:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{fk_pais_id}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{fk_pais_id}')): ?> + <?php echo form_error('alumno{fk_pais_id}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[direccion]', __('Dirección:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{direccion}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{direccion}')): ?> - <?php echo form_error('alumno{direccion}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_select_tag($alumno, 'getFkPaisId', array ( + 'related_class' => 'Pais', + 'control_name' => 'alumno[fk_pais_id]', + )) ?> + </div> + </div> - <?php echo object_input_tag($alumno, 'getDireccion', array ( - 'size' => 64, - 'control_name' => 'alumno[direccion]', -)) ?> - </div> -</div> + <div class="form-row"> + <?php echo label_for('alumno[email]', __('Email:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{email}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{email}')): ?> + <?php echo form_error('alumno{email}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[ciudad]', __('Ciudad:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{ciudad}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{ciudad}')): ?> - <?php echo form_error('alumno{ciudad}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_input_tag($alumno, 'getEmail', array ( + 'size' => 64, + 'control_name' => 'alumno[email]', + )) ?> + </div> + </div> - <?php echo object_input_tag($alumno, 'getCiudad', array ( - 'size' => 64, - 'control_name' => 'alumno[ciudad]', -)) ?> - </div> -</div> + <div class="form-row"> + <?php echo label_for('alumno[activo]', __('¿Está activo?:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{activo}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{activo}')): ?> + <?php echo form_error('alumno{activo}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[fk_provincia_id]', __('Provincia:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{fk_provincia_id}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{fk_provincia_id}')): ?> - <?php echo form_error('alumno{fk_provincia_id}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_checkbox_tag($alumno, 'getActivo', array ( + 'control_name' => 'alumno[activo]', + )) ?> + </div> + </div> - <?php echo object_select_tag($alumno, 'getFkProvinciaId', array ( - 'related_class' => 'Provincia', - 'control_name' => 'alumno[fk_provincia_id]', - 'include_custom' => '>>Seleccione una Provincia<<', -)) ?> - </div> -</div> + </fieldset> + <fieldset id="sf_fieldset_donde_vive" class=""> + <h2><?php echo __('Donde vive') ?></h2> + <br> + <?php + if(isset($datosCuenta) and $datosCuenta) { + echo button_to("Cargar datos de la cuenta", "#", array("class" => "sf_admin_action_sava", "onClick" => "javascript:completaDatos()")); + } + ?> -<div class="form-row"> - <?php echo label_for('alumno[codigo_postal]', __('CP:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{codigo_postal}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{codigo_postal}')): ?> - <?php echo form_error('alumno{codigo_postal}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[direccion]', __('Dirección:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{direccion}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{direccion}')): ?> + <?php echo form_error('alumno{direccion}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_input_tag($alumno, 'getCodigoPostal', array ( - 'size' => 20, - 'control_name' => 'alumno[codigo_postal]', -)) ?> - </div> -</div> + <?php echo object_input_tag($alumno, 'getDireccion', array ( + 'size' => 64, + 'control_name' => 'alumno[direccion]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[telefono]', __('Teléfono:'), '') ?> - <div class="content<?php if ($sf_request->hasError('alumno{telefono}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{telefono}')): ?> - <?php echo form_error('alumno{telefono}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <div class="form-row"> + <?php echo label_for('alumno[ciudad]', __('Ciudad:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{ciudad}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{ciudad}')): ?> + <?php echo form_error('alumno{ciudad}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> - <?php echo object_input_tag($alumno, 'getTelefono', array ( - 'size' => 20, - 'control_name' => 'alumno[telefono]', -)) ?> - </div> -</div> + <?php echo object_input_tag($alumno, 'getCiudad', array ( + 'size' => 64, + 'control_name' => 'alumno[ciudad]', + )) ?> + </div> + </div> -</fieldset> -<fieldset id="sf_fieldset_prioridades" class=""> -<h2><?php echo __('Prioridades') ?></h2> + <div class="form-row"> + <?php echo label_for('alumno[fk_provincia_id]', __('Provincia:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{fk_provincia_id}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{fk_provincia_id}')): ?> + <?php echo form_error('alumno{fk_provincia_id}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[distancia_escuela]', __('Distancia de la escuela (cuadras):'), '') ?> - <div class="content<?php if ($sf_request->hasError('alumno{distancia_escuela}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{distancia_escuela}')): ?> - <?php echo form_error('alumno{distancia_escuela}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_select_tag($alumno, 'getFkProvinciaId', array ( + 'related_class' => 'Provincia', + 'control_name' => 'alumno[fk_provincia_id]', + 'include_custom' => '>>Seleccione una Provincia<<', + )) ?> + </div> + </div> - <?php echo object_input_tag($alumno, 'getDistanciaEscuela', array ( - 'size' => 7, - 'control_name' => 'alumno[distancia_escuela]', -)) ?> - </div> -</div> + <div class="form-row"> + <?php echo label_for('alumno[codigo_postal]', __('CP:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{codigo_postal}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{codigo_postal}')): ?> + <?php echo form_error('alumno{codigo_postal}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[hermanos_escuela]', __('¿Hermanos en la escuela?:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{hermanos_escuela}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{hermanos_escuela}')): ?> - <?php echo form_error('alumno{hermanos_escuela}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_input_tag($alumno, 'getCodigoPostal', array ( + 'size' => 20, + 'control_name' => 'alumno[codigo_postal]', + )) ?> + </div> + </div> - <?php echo object_checkbox_tag($alumno, 'getHermanosEscuela', array ( - 'control_name' => 'alumno[hermanos_escuela]', -)) ?> - </div> -</div> + <div class="form-row"> + <?php echo label_for('alumno[telefono]', __('Teléfono:'), '') ?> + <div class="content<?php if ($sf_request->hasError('alumno{telefono}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{telefono}')): ?> + <?php echo form_error('alumno{telefono}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[hijo_maestro_escuela]', __('¿Alguno de sus padres es Maestro?:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{hijo_maestro_escuela}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{hijo_maestro_escuela}')): ?> - <?php echo form_error('alumno{hijo_maestro_escuela}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_input_tag($alumno, 'getTelefono', array ( + 'size' => 20, + 'control_name' => 'alumno[telefono]', + )) ?> + </div> + </div> - <?php echo object_checkbox_tag($alumno, 'getHijoMaestroEscuela', array ( - 'control_name' => 'alumno[hijo_maestro_escuela]', -)) ?> - </div> -</div> + </fieldset> + <fieldset id="sf_fieldset_prioridades" class=""> + <h2><?php echo __('Prioridades') ?></h2> -</fieldset> -<fieldset id="sf_fieldset_otros" class=""> -<h2><?php echo __('Otros') ?></h2> + <div class="form-row"> + <?php echo label_for('alumno[distancia_escuela]', __('Distancia de la escuela (cuadras):'), '') ?> + <div class="content<?php if ($sf_request->hasError('alumno{distancia_escuela}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{distancia_escuela}')): ?> + <?php echo form_error('alumno{distancia_escuela}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<div class="form-row"> - <?php echo label_for('alumno[certificado_medico]', __('Trajo el certificado médico?:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{certificado_medico}')): ?> form-error<?php endif; ?>"> - <?php if ($sf_request->hasError('alumno{certificado_medico}')): ?> - <?php echo form_error('alumno{certificado_medico}', array('class' => 'form-error-msg')) ?> - <?php endif; ?> + <?php echo object_input_tag($alumno, 'getDistanciaEscuela', array ( + 'size' => 7, + 'control_name' => 'alumno[distancia_escuela]', + )) ?> + </div> + </div> - <?php echo object_checkbox_tag($alumno, 'getCertificadoMedico', array ( - 'control_name' => 'alumno[certificado_medico]', -)) ?> - </div> -</div> + <div class="form-row"> + <?php echo label_for('alumno[hermanos_escuela]', __('¿Hermanos en la escuela?:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{hermanos_escuela}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{hermanos_escuela}')): ?> + <?php echo form_error('alumno{hermanos_escuela}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> + <?php echo object_checkbox_tag($alumno, 'getHermanosEscuela', array ( + 'control_name' => 'alumno[hermanos_escuela]', + )) ?> + </div> + </div> -<div class="form-row"> - <?php echo label_for('alumno[fk_cuenta_id]', __('Cuenta:'), 'class="required" ') ?> - <div class="content<?php if ($sf_request->hasError('alumno{fk_cuenta_id}')): ?> form-error<?php endif; ?>"> - <div id="cuenta"> - <?php if($alumno->getFkCuentaId()) { ?> - <?php echo include_partial('verCuenta', array('cuenta_nombre' => $alumno->getCuenta()->getNombre(), 'cuenta_id' => $alumno->getCuenta()->getId()) ); ?> - <?php } else { ?> - <?php echo include_partial('buscarCuenta'); ?> - <? } ?> - </div> - </div> - <br><?php echo link_to_remote('Nueva Cuenta', array('update' => 'nueva_cuenta', 'url' => 'alumno/nuevaCuenta?vista=noMuestraMenu' )); ?> -</div> + <div class="form-row"> + <?php echo label_for('alumno[hijo_maestro_escuela]', __('¿Alguno de sus padres es Maestro?:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{hijo_maestro_escuela}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{hijo_maestro_escuela}')): ?> + <?php echo form_error('alumno{hijo_maestro_escuela}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> + <?php echo object_checkbox_tag($alumno, 'getHijoMaestroEscuela', array ( + 'control_name' => 'alumno[hijo_maestro_escuela]', + )) ?> + </div> + </div> + </fieldset> + <fieldset id="sf_fieldset_otros" class=""> + <h2><?php echo __('Otros') ?></h2> -</fieldset> + <div class="form-row"> + <?php echo label_for('alumno[certificado_medico]', __('Trajo el certificado médico?:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{certificado_medico}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{certificado_medico}')): ?> + <?php echo form_error('alumno{certificado_medico}', array('class' => 'form-error-msg')) ?> + <?php endif; ?> -<?php echo include_partial('edit_actions', array('alumno' => $alumno)) ?> + <?php echo object_checkbox_tag($alumno, 'getCertificadoMedico', array ( + 'control_name' => 'alumno[certificado_medico]', + )) ?> + </div> + </div> -</form> + <div class="form-row"> + <?php echo label_for('alumno[fk_cuenta_id]', __('Cuenta:'), 'class="required" ') ?> + <div class="content<?php if ($sf_request->hasError('alumno{fk_cuenta_id}')): ?> form-error<?php endif; ?>"> + <div id="cuenta"> + <?php if($alumno->getFkCuentaId()) { ?> + <?php echo include_partial('verCuenta', array('cuenta_nombre' => $alumno->getCuenta()->getNombre(), 'cuenta_id' => $alumno->getCuenta()->getId()) ); ?> + <?php } else { ?> + <?php echo include_partial('buscarCuenta'); ?> + <? } ?> + </div> + </div> + <br><?php echo link_to_remote('Nueva Cuenta', array('update' => 'nueva_cuenta', 'url' => 'alumno/nuevaCuenta?vista=noMuestraMenu' )); ?> + </div> -<ul class="sf_admin_actions"> - <li class="float-left"><?php if ($alumno->getId()): ?> -<?php echo button_to(__('delete'), 'alumno/delete?id='.$alumno->getId(), array ( - 'post' => true, - 'confirm' => __('Are you sure?'), - 'class' => 'sf_admin_action_delete', -)) ?><?php endif; ?> -</li> - </ul> + </fieldset> -</div> + <?php echo include_partial('edit_actions', array('alumno' => $alumno)) ?> -<div id="sf_admin_footer"> -<?php include_partial('alumno/edit_footer', array('alumno' => $alumno)) ?> -</div> + </form> + <ul class="sf_admin_actions"> + <li class="float-left"><?php if ($alumno->getId()): ?> + <?php echo button_to(__('delete'), 'alumno/delete?id='.$alumno->getId(), array ( + 'post' => true, + 'confirm' => __('Are you sure?'), + 'class' => 'sf_admin_action_delete', + )) ?><?php endif; ?> + </li> + </ul> + </div> -<div id="nueva_cuenta"> + <div id="sf_admin_footer"> + <?php include_partial('alumno/edit_footer', array('alumno' => $alumno)) ?> + </div> + <div id="nueva_cuenta"></div> </div> - - Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/listSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/listSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/listSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -2,7 +2,7 @@ // auto-generated by sfPropelAdmin // date: 2007/02/14 16:46:15 ?> -<?php use_helpers('I18N', 'Date') ?> +<?php use_helper('I18N', 'Date') ?> <h1><?php echo __(' ', array()) ?></h1> @@ -41,15 +41,15 @@ <tr><th colspan="8"> <div class="float-right"> <?php if ($pager->haveToPaginate()): ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/first.png', 'align=absmiddle'), 'alumno/list?page=1') ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/previous.png', 'align=absmiddle'), 'alumno/list?page='.$pager->getPreviousPage()) ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/first.png', 'align=absmiddle'), 'alumno/list?page=1') ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/previous.png', 'align=absmiddle'), 'alumno/list?page='.$pager->getPreviousPage()) ?> <?php foreach ($pager->getLinks() as $page): ?> <?php echo link_to_unless($page == $pager->getPage(), $page, 'alumno/list?page='.$page) ?> <?php endforeach; ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/next.png', 'align=absmiddle'), 'alumno/list?page='.$pager->getNextPage()) ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/last.png', 'align=absmiddle'), 'alumno/list?page='.$pager->getLastPage()) ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/next.png', 'align=absmiddle'), 'alumno/list?page='.$pager->getNextPage()) ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/last.png', 'align=absmiddle'), 'alumno/list?page='.$pager->getLastPage()) ?> <?php endif; ?> </div> <?php echo format_number_choice('[0] no result|[1] 1 result|(1,+Inf] %1% results', array('%1%' => $pager->getNbResults()), $pager->getNbResults()) ?> Modified: prosistem/alba/trunk/alba/apps/principal/modules/anio/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/anio/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/anio/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -22,8 +22,8 @@ * anio actions. * * @package alba - * @author JosᅵLuis Di Biase <[email protected]> - * @author Hᅵtor Sanchez <[email protected]> + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> * @author Fernando Toledo <[email protected]> * @version SVN: $Id$ * @filesource @@ -37,7 +37,7 @@ $this->vista = $this->getRequestParameter('vista'); } - protected function addFiltersCriteria (&$c) { + protected function addFiltersCriteria ($c) { $c->add(AnioPeer::FK_ESTABLECIMIENTO_ID,$this->getUser()->getAttribute('fk_establecimiento_id')); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -65,8 +65,10 @@ $nombre_completo_archivo = ""; $bool_gd = array_search("gd", get_loaded_extensions()); + if ($this->getUser()->getAttribute('fk_ciclolectivo_id') == 0) + return $this->redirect('ciclolectivo/sinciclolectivo?m=' . $this->getRequestParameter('module')); // tomando los datos del formulario y completando variable - + $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id'); $ciclolectivo = CiclolectivoPeer::retrieveByPK($ciclolectivo_id); @@ -408,4 +410,4 @@ } } -?> +?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,5 @@ +<?php use_helper('DateForm') ?> + <? /** * This file is part of Alba. Modified: prosistem/alba/trunk/alba/apps/principal/modules/boletin/config/view.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/boletin/config/view.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/boletin/config/view.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,3 @@ default: - stylesheets: [../sf/css/sf_admin/main] + stylesheets: [..%SF_ADMIN_WEB_DIR%/css/main] \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/_horarioMaterias.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/_horarioMaterias.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/_horarioMaterias.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -5,7 +5,7 @@ $aHorario = $sf_user->getAttribute('horarios_'.$name); foreach($aHorario as $horarioMaterias_id => $quantity) { for($i=1;$i<=$quantity;$i++) { - echo image_tag('/sf/images/sf_admin/tick.png', array('class' => 'horarioMaterias-items','id' => $name.'_'.$horarioMaterias_id.'_'.$i, 'style' => 'position:relative')); + echo image_tag(sfConfig::get('sf_admin_web_dir').'/images/tick.png', array('class' => 'horarioMaterias-items','id' => $name.'_'.$horarioMaterias_id.'_'.$i, 'style' => 'position:relative')); echo draggable_element($name.'_'.$horarioMaterias_id.'_'.$i, array('revert' => true)); } ?><span class="title"><?= $horasMaterias[$horarioMaterias_id]->nombre ?></span><? Modified: prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/busquedaDocenteSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/busquedaDocenteSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/busquedaDocenteSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -40,7 +40,7 @@ <td><?echo $docente->getApellido()." ".$docente->getNombre(); ?></td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => __('verHorario'), 'title' => __('verHorario'))), 'calendario?action=horarioSegunDocente&id='.$docente->getId()); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => __('verHorario'), 'title' => __('verHorario'))), 'calendario?action=horarioSegunDocente&id='.$docente->getId()); ?></li> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/indexSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/indexSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/calendario/templates/indexSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -87,7 +87,7 @@ </script> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <div > Modified: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -188,7 +188,7 @@ return $string; } - protected function addFiltersCriteria(&$c) + protected function addFiltersCriteria($c) { $c->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); @@ -296,7 +296,10 @@ return true; } - + + public function executeSinciclolectivo() { + $this->modulo = $this->getRequestParameter('m'); + } } ?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/agregarTurnosYPeriodosSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/agregarTurnosYPeriodosSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/agregarTurnosYPeriodosSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,5 @@ +<?php use_helper('DateForm') ?> + <script> function linkTo() { @@ -54,10 +56,10 @@ </div> </td> <td> <?php echo input_date_tag('ciclolectivo[fecha_inicio]', $ciclolectivo->getFechaInicio() , array('rich'=>true, - 'calendar_button_img'=>'/sf/images/sf_admin/date.png', + 'calendar_button_img'=>sfConfig::get('sf_admin_web_dir').'/images/date.png', 'control_name'=>'ciclolectivo[fecha_inicio]')) ?> </td> -<? //echo image_tag('/sf/images/sf_admin/date.png', array("id" => "trigger_ciclolectivo[fecha_inicio]", "style" => "cursor: pointer", "align" => "absmiddle", "alt" => "date")); +<? //echo image_tag(sfConfig::get('sf_admin_web_dir').'/images/date.png', array("id" => "trigger_ciclolectivo[fecha_inicio]", "style" => "cursor: pointer", "align" => "absmiddle", "alt" => "date")); ?> <td> <?php echo input_date_tag('ciclolectivo[fecha_fin]', $ciclolectivo->getFechaFin() , 'rich=true calendar_button_img=/sf/images/sf_admin/date.png control_name=ciclolectivo[fecha_fin]'); ?></td> <td><?echo $ciclolectivo->getEstablecimiento()->getNombre();?></td> @@ -100,7 +102,7 @@ <?php echo input_hidden_tag("turnos[$i][id]", $turno->getId()); ?> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'ciclolectivo/deleteTurno?idTurno='.$turno->getId().'&id='.$sf_params->get('id')); ?> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'ciclolectivo/deleteTurno?idTurno='.$turno->getId().'&id='.$sf_params->get('id')); ?> </ul> </td> </tr> @@ -153,7 +155,7 @@ <?php echo input_hidden_tag("periodo[$i][id]", $periodo->getId()); ?> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'ciclolectivo/deletePeriodo?idPeriodo='.$periodo->getId().'&id='.$sf_params->get('id')); ?> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'ciclolectivo/deletePeriodo?idPeriodo='.$periodo->getId().'&id='.$sf_params->get('id')); ?> </ul> </td> Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/sinciclolectivoSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/sinciclolectivoSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/sinciclolectivoSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,3 @@ +<p>El módulo <?php echo $modulo?> necesita de un Ciclo Lectivo válido.</p> + +<p>Por favor, haga click <?php echo link_to('aquí','ciclolectivo/cambiar')?> para seleccionar uno.</p> \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/sinciclolectivoSuccess.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Modified: prosistem/alba/trunk/alba/apps/principal/modules/cuenta/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/cuenta/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/cuenta/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -44,8 +44,8 @@ public function executeVerCompleta(){ $c = new Criteria(); $c->add(CuentaPeer::ID, $this->getRequestParameter('id')); - $this->aCuenta = CuentaPeer::doSelect($c); - + $this->cuenta = CuentaPeer::doSelectOne($c); + $this->forward404Unless($this->cuenta); $c = new Criteria(); $c->add(AlumnoPeer::FK_CUENTA_ID, $this->getRequestParameter('id')); $this->aAlumno = AlumnoPeer::doSelect($c); @@ -55,7 +55,7 @@ $this->aResponsable = ResponsablePeer::doSelect($c); } - protected function addSortCriteria (&$c) + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'nombre', 'sf_admin/cuenta/sort')) { Modified: prosistem/alba/trunk/alba/apps/principal/modules/cuenta/templates/verCompletaSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/cuenta/templates/verCompletaSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/cuenta/templates/verCompletaSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,8 +1,6 @@ <div id="content"> -<?php - foreach($aCuenta as $cuenta){ -?> <h1>Composición de la Cuenta: <?php echo $cuenta->getNombre()?></h1> +<div id="sf_admin_container"> <div id="sf_admin_content"> <table align="center" class="sf_admin_list"> <tr> @@ -31,7 +29,6 @@ </tr> </table> </div> -<?php }?> <br> <div id="sf_admin_content"> <h1>Alumnos</h1> @@ -164,4 +161,5 @@ <?php echo button_to(__('create'), 'responsable/create?fk_cuenta_id=' . $cuenta->getId(), array ('class' => 'sf_admin_action_create', )) ?> </li> </ul> +</div> </div> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/division/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/division/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/division/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -37,7 +37,7 @@ $this->vista = $this->getRequestParameter('vista'); } - protected function addFiltersCriteria(&$c) + protected function addFiltersCriteria($c) { $c->add(AnioPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); $c->addJoin(DivisionPeer::FK_ANIO_ID,AnioPeer::ID); Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -68,7 +68,7 @@ $relDocenteEstablecimientos = RelDocenteEstablecimientoPeer::doDelete($criteria); } - protected function addFiltersCriteria(&$c) + protected function addFiltersCriteria($c) { $c->addJoin(DocentePeer::ID,RelDocenteEstablecimientoPeer::FK_DOCENTE_ID, Criteria::LEFT_JOIN); $c->add(RelDocenteEstablecimientoPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); Modified: prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -35,7 +35,7 @@ { public function preExecute () { - $this->getResponse()->addStylesheet('/sf/css/sf_admin/main', 'first'); + $this->getResponse()->addStylesheet(sfConfig::get('sf_admin_web_dir').'/css/main', 'first'); $this->vista = $this->getRequestParameter('vista'); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,5 @@ +<?php use_helper('DateForm') ?> + <script> function linkTo() { @@ -47,7 +49,7 @@ <?php echo input_hidden_tag("horario[$i][id]", $horario->getId()); ?> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'docenteHorario/deleteHorario?id='.$horario->getId()); ?> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'docenteHorario/deleteHorario?id='.$horario->getId()); ?> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/escalanota/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/escalanota/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/escalanota/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -22,8 +22,8 @@ * escalanota Acciones * * @package alba - * @author José Luis Di Biase <[email protected]> - * @author Héctor Sanchez <[email protected]> + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> * @author Fernando Toledo <[email protected]> * @version SVN: $Id$ * @filesource @@ -32,7 +32,7 @@ class escalanotaActions extends autoescalanotaActions { - protected function addFiltersCriteria(&$c) { + protected function addFiltersCriteria($c) { $c->add(EscalanotaPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/feriado/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/feriado/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/feriado/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -85,12 +85,12 @@ else { // add javascripts - $this->getResponse()->addJavascript('/sf/js/prototype/prototype'); - $this->getResponse()->addJavascript('/sf/js/sf_admin/collapse'); + $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype'); + $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir').'/js/collapse'); } } - protected function addFiltersCriteria(&$c) { + protected function addFiltersCriteria($c) { $c->add(FeriadoPeer::FK_CICLOLECTIVO_ID,$this->getUser()->getAttribute('fk_ciclolectivo_id')); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -81,7 +81,7 @@ } - function addFiltersCriteria(&$c) { + function addFiltersCriteria($c) { $c->add(horarioescolarPeer::FK_ESTABLECIMIENTO_ID,$this->getUser()->getAttribute('fk_establecimiento_id')); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_fin.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_fin.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_fin.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +1,3 @@ +<?php use_helper('DateForm') ?> + <?echo select_time_tag("horarioescolar[hora_fin]", $horarioescolar->getHoraFin(), array('include_second' => false, '12hour_time' => true));?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_inicio.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_inicio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/_hora_inicio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +1,3 @@ +<?php use_helper('DateForm') ?> + <?echo select_time_tag("horarioescolar[hora_inicio]", $horarioescolar->getHoraInicio(), array('include_second' => false, '12hour_time' => true));?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarFormSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarFormSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarFormSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -15,7 +15,7 @@ </script> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <h1><?php echo __('Ver Horario Escolar', array()) ?></h1> Modified: prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/templates/mostrarSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -15,7 +15,7 @@ </script> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <h1><?php echo __('Ver Horario Escolar', array()) ?></h1> Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/boletinFormularioSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/boletinFormularioSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/boletinFormularioSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -46,7 +46,7 @@ <td><?echo $alumno->alumno_apellido." ".$alumno->alumno_nombre; ?> ( <?=$alumno->anio_descripcion?> - <?=$alumno->division_nombre?> ) </td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=boletinListado&vista=imprimir&alumno_id='.$alumno->alumno_id."&division_id=".$alumno->division_id); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=boletinListado&vista=imprimir&alumno_id='.$alumno->alumno_id."&division_id=".$alumno->division_id); ?></li> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosBusquedaFormularioSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosBusquedaFormularioSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosBusquedaFormularioSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -41,7 +41,7 @@ <td><?echo $alumno->alumno_apellido." ".$alumno->alumno_nombre; ?></td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=certificadoEstudiosFormulario&alumno_id='.$alumno->alumno_id); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=certificadoEstudiosFormulario&alumno_id='.$alumno->alumno_id); ?></li> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosFormularioSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosFormularioSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoEstudiosFormularioSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,5 @@ +<?php use_helper('DateForm') ?> + <h1>Informe: Certificado de Estudios para <?php echo $alumno->getApellido().", ".$alumno->getNombre();?></h1> <?php if ($sf_request->hasErrors()) {?> Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoPrimariaFormularioSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoPrimariaFormularioSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/certificadoPrimariaFormularioSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -41,7 +41,7 @@ <td><?echo $alumno->alumno_apellido." ".$alumno->alumno_nombre; ?></td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=certificadoPrimariaListado&alumno_id='.$alumno->alumno_id); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=certificadoPrimariaListado&alumno_id='.$alumno->alumno_id); ?></li> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/constanciaAlumnoRegularFormularioSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/constanciaAlumnoRegularFormularioSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/constanciaAlumnoRegularFormularioSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -46,7 +46,7 @@ <td><?echo $alumno->alumno_apellido." ".$alumno->alumno_nombre; ?> ( <?=$alumno->anio_descripcion?> - <?=$alumno->division_nombre?> ) </td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=constanciaAlumnoRegularListado&alumno_id='.$alumno->alumno_id."&division_id=".$alumno->division_id); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=constanciaAlumnoRegularListado&alumno_id='.$alumno->alumno_id."&division_id=".$alumno->division_id); ?></li> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/solicitudLegajoBusquedaFormularioSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/solicitudLegajoBusquedaFormularioSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/solicitudLegajoBusquedaFormularioSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -46,7 +46,7 @@ <td><?echo $alumno->alumno_apellido." ".$alumno->alumno_nombre; ?> ( <?=$alumno->anio_descripcion?> - <?=$alumno->division_nombre?> ) </td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=solicitudLegajoFormulario&alumno_id='.$alumno->alumno_id."&division_id=".$alumno->division_id); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'informes?action=solicitudLegajoFormulario&alumno_id='.$alumno->alumno_id."&division_id=".$alumno->division_id); ?></li> </ul> </td> </tr> Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -234,8 +234,8 @@ } // add javascripts - $this->getResponse()->addJavascript('/sf/js/prototype/prototype'); - $this->getResponse()->addJavascript('/sf/js/sf_admin/collapse'); + $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype'); + $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir').'/js/collapse'); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/config/view.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/config/view.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/config/view.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ default: - stylesheets: [../sf/css/sf_admin/main] + stylesheets: [..%SF_ADMIN_WEB_DIR%/css/main] Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/editSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/editSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/editSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <h1><?php echo __('Editar Entrada en Legajo Pedagógico para '.$alumno->getApellido().' '.$alumno->getNombre(), array()) ?></h1> @@ -41,7 +41,7 @@ <?php echo object_input_date_tag($legajopedagogico, 'getFecha', array ( 'rich' => true, 'withtime' => true, - 'calendar_button_img' => '/sf/images/sf_admin/date.png', + 'calendar_button_img' => sfConfig::get('sf_admin_web_dir').'/images/date.png', 'control_name' => 'legajopedagogico[fecha]', )) ?> </div> Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -48,7 +48,7 @@ <td><?echo $alumno->alumno_apellido." ".$alumno->alumno_nombre; ?></td> <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'alumno?action=edit&id='.$alumno->alumno_id); ?></li> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => 'editar', 'title' => 'Editar')) , 'alumno?action=edit&id='.$alumno->alumno_id); ?></li> <li><?php echo link_to(image_tag('small/legajo.png', array('alt' => __('verLegajo'), 'title' => 'Ver el legajo')), 'legajopedagogico?action=verLegajo&aid='.$alumno->alumno_id); ?></li> Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/verLegajoSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/verLegajoSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/verLegajoSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ -<?php use_helpers('I18N', 'Date') ?> +<?php use_helper('I18N', 'Date') ?> <script> function filterCat() { var objc = document.getElementById('legajo_categoria_id'); @@ -59,9 +59,9 @@ <td> <ul class="sf_admin_td_actions"> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/edit_icon.png', array('alt' => __('verLegajo'), 'title' => __('verLegajo'))), 'legajopedagogico?action=edit&aid='.$alumno->getId().'&id='.$entradaLegajo->getId().'&cid='.$entradaLegajo->getFkLegajocategoriaId()); ?> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/edit_icon.png', array('alt' => __('verLegajo'), 'title' => __('verLegajo'))), 'legajopedagogico?action=edit&aid='.$alumno->getId().'&id='.$entradaLegajo->getId().'&cid='.$entradaLegajo->getFkLegajocategoriaId()); ?> - <li><?php echo link_to(image_tag('/sf/images/sf_admin/delete_icon.png', array('alt' => __('borrar'), 'title' => __('borrar'))), 'legajopedagogico?action=delete&aid='.$alumno->getId().'&id='.$entradaLegajo->getId().'&cid='.$entradaLegajo->getFkLegajocategoriaId()); ?> + <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/delete_icon.png', array('alt' => __('borrar'), 'title' => __('borrar'))), 'legajopedagogico?action=delete&aid='.$alumno->getId().'&id='.$entradaLegajo->getId().'&cid='.$entradaLegajo->getFkLegajocategoriaId()); ?> </ul> </td> Modified: prosistem/alba/trunk/alba/apps/principal/modules/provincia/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/provincia/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/provincia/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -23,8 +23,8 @@ * Provincia Acciones * * @package alba - * @author José Luis Di Biase <[email protected]> - * @author Héctor Sanchez <[email protected]> + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> * @author Fernando Toledo <[email protected]> * @version SVN: $Id$ * @filesource @@ -36,7 +36,7 @@ $this->vista = $this->getRequestParameter('vista'); } - protected function addSortCriteria (&$c) { + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'nombre_corto', 'sf_admin/provincia/sort')) { $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column); if ($this->getUser()->getAttribute('type', 'asc', 'sf_admin/provincia/sort') == 'asc') { Modified: prosistem/alba/trunk/alba/apps/principal/modules/relAlumnoDivision/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/relAlumnoDivision/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/relAlumnoDivision/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -36,7 +36,7 @@ public function preExecute() { $this->vista = $this->getRequestParameter('vista'); } - protected function addFiltersCriteria (&$c) + protected function addFiltersCriteria ($c) { $c->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID,$this->getUser()->getAttribute('fk_establecimiento_id')); $c->addJoin(AlumnoPeer::ID,RelAlumnoDivisionPeer::FK_ALUMNO_ID); Modified: prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -91,8 +91,8 @@ else { // add javascripts - $this->getResponse()->addJavascript('/sf/js/prototype/prototype'); - $this->getResponse()->addJavascript('/sf/js/sf_admin/collapse'); + $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype'); + $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir').'/js/collapse'); if ($this->getRequestParameter('fk_alumno_id')) $this->rel_calendariovacunacion_alumno->setFkAlumnoId($this->getRequestParameter('fk_alumno_id')); Modified: prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/editSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/editSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/editSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -2,7 +2,7 @@ // auto-generated by sfPropelAdmin // date: 2007/02/16 11:42:06 ?> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <div id="sf_admin_header"> @@ -109,7 +109,7 @@ <?php echo object_input_date_tag($rel_calendariovacunacion_alumno, 'getFecha', array ( 'rich' => true, 'withtime' => true, - 'calendar_button_img' => '/sf/images/sf_admin/date.png', + 'calendar_button_img' => sfConfig::get('sf_admin_web_dir').'/images/date.png', 'control_name' => 'rel_calendariovacunacion_alumno[fecha]', )) ?> </div> Modified: prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/listSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/listSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/relCalendariovacunacionAlumno/templates/listSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -2,7 +2,7 @@ // auto-generated by sfPropelAdmin // date: 2007/02/16 11:08:08 ?> -<?php use_helpers('I18N', 'Date') ?> +<?php use_helper('I18N', 'Date') ?> <div id="sf_admin_header"> <?php include_partial('relCalendariovacunacionAlumno/list_header', array('filters' => $filters)) ?> @@ -38,15 +38,15 @@ <tr><th colspan="6"> <div class="float-right"> <?php if ($pager->haveToPaginate()): ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/first.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page=1') ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/previous.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page='.$pager->getPreviousPage()) ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/first.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page=1') ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/previous.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page='.$pager->getPreviousPage()) ?> <?php foreach ($pager->getLinks() as $page): ?> <?php echo link_to_unless($page == $pager->getPage(), $page, 'relCalendariovacunacionAlumno/list?page='.$page) ?> <?php endforeach; ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/next.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page='.$pager->getNextPage()) ?> - <?php echo link_to(image_tag('/sf/images/sf_admin/last.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page='.$pager->getLastPage()) ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/next.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page='.$pager->getNextPage()) ?> + <?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/last.png', 'align=absmiddle'), 'relCalendariovacunacionAlumno/list?page='.$pager->getLastPage()) ?> <?php endif; ?> </div> <?php echo format_number_choice('[0] no result|[1] 1 result|(1,+Inf] %1% results', array('%1%' => $pager->getNbResults()), $pager->getNbResults()) ?> Modified: prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -35,7 +35,7 @@ $this->vista = $this->getRequestParameter('vista'); } - protected function addSortCriteria (&$c) { + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'apellido', 'sf_admin/responsable/sort')) { $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column); if ($this->getUser()->getAttribute('type', 'asc', 'sf_admin/responsable/sort') == 'asc') { @@ -73,8 +73,8 @@ } else { // add javascripts - $this->getResponse()->addJavascript('/sf/js/prototype/prototype'); - $this->getResponse()->addJavascript('/sf/js/sf_admin/collapse'); + $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype'); + $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir').'/js/collapse'); if ($this->getRequestParameter('fk_cuenta_id')) $this->responsable->setFkCuentaId($this->getRequestParameter('fk_cuenta_id')); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -20,7 +20,7 @@ <? } ?> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <h1><?php echo __('Editar Responsable',array()); Modified: prosistem/alba/trunk/alba/apps/principal/modules/seguridad/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/seguridad/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/seguridad/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ -<?php +<?php /** * This file is part of Alba. * Modified: prosistem/alba/trunk/alba/apps/principal/modules/seguridad/templates/_login.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/seguridad/templates/_login.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/seguridad/templates/_login.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -9,7 +9,7 @@ <td class="etiqueta"> Usuario: </td> - <td class="karu"> + <td> <div class="error"> <?php echo form_error('login') ?> </div> @@ -23,7 +23,7 @@ <td class="etiqueta"> Clave: </td> - <td class="karu"> + <td> <div class="error"> <?php echo form_error('password') ?> </div> Modified: prosistem/alba/trunk/alba/apps/principal/modules/tipodocumento/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/tipodocumento/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/tipodocumento/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -23,8 +23,8 @@ * TipoDocumento Acciones * * @package alba - * @author José Luis Di Biase <[email protected]> - * @author Héctor Sanchez <[email protected]> + * @author José Luis Di Biase <[email protected]> + * @author Héctor Sanchez <[email protected]> * @author Fernando Toledo <[email protected]> * @version SVN: $Id: albaUsuarioValidator.class.php 3894 2006-12-18 17:47:12Z josx $ * @filesource @@ -36,7 +36,7 @@ $this->vista = $this->getRequestParameter('vista'); } - protected function addSortCriteria (&$c) { + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'nombre', 'sf_admin/tipodocumento/sort')) { $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column); if ($this->getUser()->getAttribute('type', 'asc', 'sf_admin/tipodocumento/sort') == 'asc') { Modified: prosistem/alba/trunk/alba/apps/principal/modules/turnos/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/turnos/actions/actions.class.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/turnos/actions/actions.class.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,4 +1,4 @@ -<?php +<?php /** * This file is part of Alba. * @@ -34,7 +34,7 @@ $this->vista = $this->getRequestParameter('vista'); } - function addFiltersCriteria(&$c) { + function addFiltersCriteria($c) { $c->add(TurnosPeer::FK_CICLOLECTIVO_ID,$this->getUser()->getAttribute('fk_ciclolectivo_id')); } Modified: prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_fin.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_fin.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_fin.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +1,3 @@ +<?php use_helper('DateForm') ?> + <?php echo select_time_tag("turnos[hora_fin]", $turnos->getHoraFin(), array('include_second' => false, '12hour_time' => true));?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_inicio.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_inicio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/turnos/templates/_hora_inicio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +1,3 @@ +<?php use_helper('DateForm') ?> + <?php echo select_time_tag("turnos[hora_inicio]", $turnos->getHoraInicio(), array('include_second' => false, '12hour_time' => true));?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/apps/principal/modules/turnos/validate/edit.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/turnos/validate/edit.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/turnos/validate/edit.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,22 +1,27 @@ methods: - post: - - "turnos{hora_inicio}" - - "turnos{hora_fin}" - - "turnos{descripcion}" + post: + - "turnos{hora_inicio}" + - "turnos{hora_fin}" + - "turnos{descripcion}" fillin: enabled: on + names: + turnos{hora_inicio}: required: Yes required_msg: El campo hora inicio es obligatorio + turnos{hora_fin}: required: Yes required_msg: El campo hora fin es obligatorio + turnos{descripcion}: required: Yes required_msg: El campo descripción es obligatorio validators: caracteresMaximos255 + caracteresMaximos255: class: sfStringValidator param: Modified: prosistem/alba/trunk/alba/apps/principal/modules/usuario/config/generator.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/usuario/config/generator.yml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/usuario/config/generator.yml 2007-02-28 20:20:23 UTC (rev 4346) @@ -26,8 +26,8 @@ fields: fecha_creado: {type: plain} fecha_actualizado: {type: plain } - seguridad_pregunta: {help: } - seguridad_respuesta: {help: } + seguridad_pregunta: {help: ""} + seguridad_respuesta: {help: ""} list: title: Listado de Usuarios Modified: prosistem/alba/trunk/alba/apps/principal/modules/usuario/templates/editSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/usuario/templates/editSuccess.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/modules/usuario/templates/editSuccess.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -2,7 +2,7 @@ // auto-generated by sfPropelAdmin // date: 2007/02/12 11:25:47 ?> -<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> +<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?> <h1><?php echo __('', array()) ?></h1> Modified: prosistem/alba/trunk/alba/apps/principal/templates/layout.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/templates/layout.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/apps/principal/templates/layout.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -51,7 +51,9 @@ <?php if($vista == "imprimir") :?> <link rel="stylesheet" type="text/css" href="/~josx/alba/css/impresion.css" /> <? endif;?> - + <?php if (!$sf_user->isAuthenticated()):?> + <link rel="stylesheet" type="text/css" href="<?php echo sfContext::getInstance()->getRequest()->getRelativeUrlRoot()?>/css/login.css"> + <?php endif;?> </head> <body> Modified: prosistem/alba/trunk/alba/config/config.php =================================================================== --- prosistem/alba/trunk/alba/config/config.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/config/config.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,3 +1,5 @@ <?php -?> \ No newline at end of file +// symfony directories +$sf_symfony_lib_dir = dirname(__FILE__).'/../lib/symfony'; +$sf_symfony_data_dir = dirname(__FILE__).'/../data/symfony'; Modified: prosistem/alba/trunk/alba/config/schema.xml =================================================================== --- prosistem/alba/trunk/alba/config/schema.xml 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/config/schema.xml 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!--Autogenerated by CreoleToXMLSchema!--> <!-- $Id$ --> -<database name="alba"> +<database package="lib.model" name="alba"> <table name="locacion" idMethod="native"> <column name="id" type="INTEGER" required="true" autoIncrement="true" primaryKey="true"/> <column name="nombre" type="VARCHAR" size="128" required="true" default=""/> Modified: prosistem/alba/trunk/alba/lib/model/Actividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Actividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Actividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseActividad.php'; +require_once 'lib/model/om/BaseActividad.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseActividadPeer.php'; + require_once 'lib/model/om/BaseActividadPeer.php'; // include object class - include_once 'model/Actividad.php'; + include_once 'lib/model/Actividad.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Adjunto.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Adjunto.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Adjunto.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseAdjunto.php'; +require_once 'lib/model/om/BaseAdjunto.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/AdjuntoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/AdjuntoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/AdjuntoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseAdjuntoPeer.php'; + require_once 'lib/model/om/BaseAdjuntoPeer.php'; // include object class - include_once 'model/Adjunto.php'; + include_once 'lib/model/Adjunto.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Alumno.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Alumno.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Alumno.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseAlumno.php'; +require_once 'lib/model/om/BaseAlumno.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/AlumnoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/AlumnoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/AlumnoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseAlumnoPeer.php'; + require_once 'lib/model/om/BaseAlumnoPeer.php'; // include object class - include_once 'model/Alumno.php'; + include_once 'lib/model/Alumno.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Anio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Anio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Anio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseAnio.php'; +require_once 'lib/model/om/BaseAnio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/AnioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/AnioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/AnioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseAnioPeer.php'; + require_once 'lib/model/om/BaseAnioPeer.php'; // include object class - include_once 'model/Anio.php'; + include_once 'lib/model/Anio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Asistencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Asistencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Asistencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseAsistencia.php'; +require_once 'lib/model/om/BaseAsistencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/AsistenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/AsistenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/AsistenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseAsistenciaPeer.php'; + require_once 'lib/model/om/BaseAsistenciaPeer.php'; // include object class - include_once 'model/Asistencia.php'; + include_once 'lib/model/Asistencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/BoletinActividades.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/BoletinActividades.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/BoletinActividades.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseBoletinActividades.php'; +require_once 'lib/model/om/BaseBoletinActividades.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/BoletinActividadesPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/BoletinActividadesPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/BoletinActividadesPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseBoletinActividadesPeer.php'; + require_once 'lib/model/om/BaseBoletinActividadesPeer.php'; // include object class - include_once 'model/BoletinActividades.php'; + include_once 'lib/model/BoletinActividades.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/BoletinConceptual.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/BoletinConceptual.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/BoletinConceptual.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseBoletinConceptual.php'; +require_once 'lib/model/om/BaseBoletinConceptual.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/BoletinConceptualPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/BoletinConceptualPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/BoletinConceptualPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseBoletinConceptualPeer.php'; + require_once 'lib/model/om/BaseBoletinConceptualPeer.php'; // include object class - include_once 'model/BoletinConceptual.php'; + include_once 'lib/model/BoletinConceptual.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Calendariovacunacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Calendariovacunacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Calendariovacunacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseCalendariovacunacion.php'; +require_once 'lib/model/om/BaseCalendariovacunacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/CalendariovacunacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/CalendariovacunacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/CalendariovacunacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseCalendariovacunacionPeer.php'; + require_once 'lib/model/om/BaseCalendariovacunacionPeer.php'; // include object class - include_once 'model/Calendariovacunacion.php'; + include_once 'lib/model/Calendariovacunacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Cargobaja.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Cargobaja.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Cargobaja.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseCargobaja.php'; +require_once 'lib/model/om/BaseCargobaja.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/CargobajaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/CargobajaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/CargobajaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseCargobajaPeer.php'; + require_once 'lib/model/om/BaseCargobajaPeer.php'; // include object class - include_once 'model/Cargobaja.php'; + include_once 'lib/model/Cargobaja.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseCiclolectivo.php'; +require_once 'lib/model/om/BaseCiclolectivo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/CiclolectivoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/CiclolectivoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/CiclolectivoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseCiclolectivoPeer.php'; + require_once 'lib/model/om/BaseCiclolectivoPeer.php'; // include object class - include_once 'model/Ciclolectivo.php'; + include_once 'lib/model/Ciclolectivo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Concepto.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Concepto.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Concepto.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseConcepto.php'; +require_once 'lib/model/om/BaseConcepto.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ConceptoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ConceptoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ConceptoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseConceptoPeer.php'; + require_once 'lib/model/om/BaseConceptoPeer.php'; // include object class - include_once 'model/Concepto.php'; + include_once 'lib/model/Concepto.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Conceptobaja.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Conceptobaja.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Conceptobaja.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseConceptobaja.php'; +require_once 'lib/model/om/BaseConceptobaja.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ConceptobajaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ConceptobajaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ConceptobajaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseConceptobajaPeer.php'; + require_once 'lib/model/om/BaseConceptobajaPeer.php'; // include object class - include_once 'model/Conceptobaja.php'; + include_once 'lib/model/Conceptobaja.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Cuenta.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Cuenta.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Cuenta.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseCuenta.php'; +require_once 'lib/model/om/BaseCuenta.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/CuentaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/CuentaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/CuentaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseCuentaPeer.php'; + require_once 'lib/model/om/BaseCuentaPeer.php'; // include object class - include_once 'model/Cuenta.php'; + include_once 'lib/model/Cuenta.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Distritoescolar.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Distritoescolar.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Distritoescolar.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseDistritoescolar.php'; +require_once 'lib/model/om/BaseDistritoescolar.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/DistritoescolarPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/DistritoescolarPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/DistritoescolarPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseDistritoescolarPeer.php'; + require_once 'lib/model/om/BaseDistritoescolarPeer.php'; // include object class - include_once 'model/Distritoescolar.php'; + include_once 'lib/model/Distritoescolar.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Division.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Division.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Division.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseDivision.php'; +require_once 'lib/model/om/BaseDivision.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/DivisionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/DivisionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/DivisionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseDivisionPeer.php'; + require_once 'lib/model/om/BaseDivisionPeer.php'; // include object class - include_once 'model/Division.php'; + include_once 'lib/model/Division.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Docente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Docente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Docente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseDocente.php'; +require_once 'lib/model/om/BaseDocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/DocenteHorario.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/DocenteHorario.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/DocenteHorario.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseDocenteHorario.php'; +require_once 'lib/model/om/BaseDocenteHorario.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/DocenteHorarioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/DocenteHorarioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/DocenteHorarioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseDocenteHorarioPeer.php'; + require_once 'lib/model/om/BaseDocenteHorarioPeer.php'; // include object class - include_once 'model/DocenteHorario.php'; + include_once 'lib/model/DocenteHorario.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/DocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/DocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/DocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseDocentePeer.php'; + require_once 'lib/model/om/BaseDocentePeer.php'; // include object class - include_once 'model/Docente.php'; + include_once 'lib/model/Docente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Escalanota.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Escalanota.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Escalanota.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseEscalanota.php'; +require_once 'lib/model/om/BaseEscalanota.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/EscalanotaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/EscalanotaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/EscalanotaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseEscalanotaPeer.php'; + require_once 'lib/model/om/BaseEscalanotaPeer.php'; // include object class - include_once 'model/Escalanota.php'; + include_once 'lib/model/Escalanota.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Espacio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Espacio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Espacio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseEspacio.php'; +require_once 'lib/model/om/BaseEspacio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/EspacioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/EspacioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/EspacioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseEspacioPeer.php'; + require_once 'lib/model/om/BaseEspacioPeer.php'; // include object class - include_once 'model/Espacio.php'; + include_once 'lib/model/Espacio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Establecimiento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Establecimiento.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Establecimiento.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseEstablecimiento.php'; +require_once 'lib/model/om/BaseEstablecimiento.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/EstablecimientoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/EstablecimientoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/EstablecimientoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseEstablecimientoPeer.php'; + require_once 'lib/model/om/BaseEstablecimientoPeer.php'; // include object class - include_once 'model/Establecimiento.php'; + include_once 'lib/model/Establecimiento.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Examen.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Examen.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Examen.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseExamen.php'; +require_once 'lib/model/om/BaseExamen.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ExamenPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ExamenPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ExamenPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseExamenPeer.php'; + require_once 'lib/model/om/BaseExamenPeer.php'; // include object class - include_once 'model/Examen.php'; + include_once 'lib/model/Examen.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Feriado.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Feriado.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Feriado.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseFeriado.php'; +require_once 'lib/model/om/BaseFeriado.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/FeriadoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/FeriadoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/FeriadoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseFeriadoPeer.php'; + require_once 'lib/model/om/BaseFeriadoPeer.php'; // include object class - include_once 'model/Feriado.php'; + include_once 'lib/model/Feriado.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Horarioescolar.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Horarioescolar.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Horarioescolar.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseHorarioescolar.php'; +require_once 'lib/model/om/BaseHorarioescolar.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/HorarioescolarPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/HorarioescolarPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/HorarioescolarPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseHorarioescolarPeer.php'; + require_once 'lib/model/om/BaseHorarioescolarPeer.php'; // include object class - include_once 'model/Horarioescolar.php'; + include_once 'lib/model/Horarioescolar.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Horarioescolartipo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Horarioescolartipo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Horarioescolartipo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseHorarioescolartipo.php'; +require_once 'lib/model/om/BaseHorarioescolartipo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/HorarioescolartipoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/HorarioescolartipoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/HorarioescolartipoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseHorarioescolartipoPeer.php'; + require_once 'lib/model/om/BaseHorarioescolartipoPeer.php'; // include object class - include_once 'model/Horarioescolartipo.php'; + include_once 'lib/model/Horarioescolartipo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Legajoadjunto.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Legajoadjunto.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Legajoadjunto.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseLegajoadjunto.php'; +require_once 'lib/model/om/BaseLegajoadjunto.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/LegajoadjuntoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/LegajoadjuntoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/LegajoadjuntoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseLegajoadjuntoPeer.php'; + require_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; // include object class - include_once 'model/Legajoadjunto.php'; + include_once 'lib/model/Legajoadjunto.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Legajocategoria.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Legajocategoria.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Legajocategoria.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseLegajocategoria.php'; +require_once 'lib/model/om/BaseLegajocategoria.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/LegajocategoriaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/LegajocategoriaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/LegajocategoriaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseLegajocategoriaPeer.php'; + require_once 'lib/model/om/BaseLegajocategoriaPeer.php'; // include object class - include_once 'model/Legajocategoria.php'; + include_once 'lib/model/Legajocategoria.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Legajopedagogico.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Legajopedagogico.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Legajopedagogico.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseLegajopedagogico.php'; +require_once 'lib/model/om/BaseLegajopedagogico.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/LegajopedagogicoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/LegajopedagogicoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/LegajopedagogicoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseLegajopedagogicoPeer.php'; + require_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; // include object class - include_once 'model/Legajopedagogico.php'; + include_once 'lib/model/Legajopedagogico.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Locacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Locacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Locacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseLocacion.php'; +require_once 'lib/model/om/BaseLocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/LocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/LocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/LocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseLocacionPeer.php'; + require_once 'lib/model/om/BaseLocacionPeer.php'; // include object class - include_once 'model/Locacion.php'; + include_once 'lib/model/Locacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Menu.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Menu.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Menu.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseMenu.php'; +require_once 'lib/model/om/BaseMenu.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/MenuPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/MenuPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/MenuPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseMenuPeer.php'; + require_once 'lib/model/om/BaseMenuPeer.php'; // include object class - include_once 'model/Menu.php'; + include_once 'lib/model/Menu.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Modulo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Modulo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Modulo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseModulo.php'; +require_once 'lib/model/om/BaseModulo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ModuloPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ModuloPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ModuloPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseModuloPeer.php'; + require_once 'lib/model/om/BaseModuloPeer.php'; // include object class - include_once 'model/Modulo.php'; + include_once 'lib/model/Modulo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Niveltipo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Niveltipo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Niveltipo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseNiveltipo.php'; +require_once 'lib/model/om/BaseNiveltipo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/NiveltipoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/NiveltipoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/NiveltipoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseNiveltipoPeer.php'; + require_once 'lib/model/om/BaseNiveltipoPeer.php'; // include object class - include_once 'model/Niveltipo.php'; + include_once 'lib/model/Niveltipo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Organizacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Organizacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Organizacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseOrganizacion.php'; +require_once 'lib/model/om/BaseOrganizacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/OrganizacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/OrganizacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/OrganizacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseOrganizacionPeer.php'; + require_once 'lib/model/om/BaseOrganizacionPeer.php'; // include object class - include_once 'model/Organizacion.php'; + include_once 'lib/model/Organizacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Pais.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Pais.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Pais.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BasePais.php'; +require_once 'lib/model/om/BasePais.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/PaisPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/PaisPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/PaisPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BasePaisPeer.php'; + require_once 'lib/model/om/BasePaisPeer.php'; // include object class - include_once 'model/Pais.php'; + include_once 'lib/model/Pais.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Periodo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Periodo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Periodo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BasePeriodo.php'; +require_once 'lib/model/om/BasePeriodo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/PeriodoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/PeriodoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/PeriodoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BasePeriodoPeer.php'; + require_once 'lib/model/om/BasePeriodoPeer.php'; // include object class - include_once 'model/Periodo.php'; + include_once 'lib/model/Periodo.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Permiso.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Permiso.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Permiso.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BasePermiso.php'; +require_once 'lib/model/om/BasePermiso.php'; /** * Skeleton subclass for representing a row from the 'permiso' table. Modified: prosistem/alba/trunk/alba/lib/model/PermisoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/PermisoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/PermisoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BasePermisoPeer.php'; + require_once 'lib/model/om/BasePermisoPeer.php'; // include object class - include_once 'model/Permiso.php'; + include_once 'lib/model/Permiso.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Preferencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Preferencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Preferencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BasePreferencia.php'; +require_once 'lib/model/om/BasePreferencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/PreferenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/PreferenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/PreferenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BasePreferenciaPeer.php'; + require_once 'lib/model/om/BasePreferenciaPeer.php'; // include object class - include_once 'model/Preferencia.php'; + include_once 'lib/model/Preferencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Provincia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Provincia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Provincia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseProvincia.php'; +require_once 'lib/model/om/BaseProvincia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ProvinciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ProvinciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ProvinciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseProvinciaPeer.php'; + require_once 'lib/model/om/BaseProvinciaPeer.php'; // include object class - include_once 'model/Provincia.php'; + include_once 'lib/model/Provincia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelActividadDocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelActividadDocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelActividadDocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelActividadDocente.php'; +require_once 'lib/model/om/BaseRelActividadDocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelActividadDocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelActividadDocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelActividadDocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelActividadDocentePeer.php'; + require_once 'lib/model/om/BaseRelActividadDocentePeer.php'; // include object class - include_once 'model/RelActividadDocente.php'; + include_once 'lib/model/RelActividadDocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelAlumnoDivision.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelAlumnoDivision.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelAlumnoDivision.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelAlumnoDivision.php'; +require_once 'lib/model/om/BaseRelAlumnoDivision.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelAlumnoDivisionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelAlumnoDivisionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelAlumnoDivisionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + require_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; // include object class - include_once 'model/RelAlumnoDivision.php'; + include_once 'lib/model/RelAlumnoDivision.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelAnioActividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelAnioActividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelAnioActividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelAnioActividad.php'; +require_once 'lib/model/om/BaseRelAnioActividad.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelAnioActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelAnioActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelAnioActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelAnioActividadPeer.php'; + require_once 'lib/model/om/BaseRelAnioActividadPeer.php'; // include object class - include_once 'model/RelAnioActividad.php'; + include_once 'lib/model/RelAnioActividad.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumno.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumno.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumno.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelCalendariovacunacionAlumno.php'; +require_once 'lib/model/om/BaseRelCalendariovacunacionAlumno.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumnoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumnoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelCalendariovacunacionAlumnoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + require_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; // include object class - include_once 'model/RelCalendariovacunacionAlumno.php'; + include_once 'lib/model/RelCalendariovacunacionAlumno.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelDivisionActividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelDivisionActividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelDivisionActividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelDivisionActividad.php'; +require_once 'lib/model/om/BaseRelDivisionActividad.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelDivisionActividadDocente.php'; +require_once 'lib/model/om/BaseRelDivisionActividadDocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelDivisionActividadDocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + require_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; // include object class - include_once 'model/RelDivisionActividadDocente.php'; + include_once 'lib/model/RelDivisionActividadDocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelDivisionActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelDivisionActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelDivisionActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelDivisionActividadPeer.php'; + require_once 'lib/model/om/BaseRelDivisionActividadPeer.php'; // include object class - include_once 'model/RelDivisionActividad.php'; + include_once 'lib/model/RelDivisionActividad.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimiento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimiento.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimiento.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelDocenteEstablecimiento.php'; +require_once 'lib/model/om/BaseRelDocenteEstablecimiento.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimientoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimientoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelDocenteEstablecimientoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + require_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; // include object class - include_once 'model/RelDocenteEstablecimiento.php'; + include_once 'lib/model/RelDocenteEstablecimiento.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelEstablecimientoLocacion.php'; +require_once 'lib/model/om/BaseRelEstablecimientoLocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelEstablecimientoLocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + require_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; // include object class - include_once 'model/RelEstablecimientoLocacion.php'; + include_once 'lib/model/RelEstablecimientoLocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelLocacionEspacio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelLocacionEspacio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelLocacionEspacio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelLocacionEspacio.php'; +require_once 'lib/model/om/BaseRelLocacionEspacio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelLocacionEspacioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelLocacionEspacioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelLocacionEspacioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelLocacionEspacioPeer.php'; + require_once 'lib/model/om/BaseRelLocacionEspacioPeer.php'; // include object class - include_once 'model/RelLocacionEspacio.php'; + include_once 'lib/model/RelLocacionEspacio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelNivelLocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelNivelLocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelNivelLocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelNivelLocacion.php'; +require_once 'lib/model/om/BaseRelNivelLocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelNivelLocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelNivelLocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelNivelLocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelNivelLocacionPeer.php'; + require_once 'lib/model/om/BaseRelNivelLocacionPeer.php'; // include object class - include_once 'model/RelNivelLocacion.php'; + include_once 'lib/model/RelNivelLocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelRolPermiso.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelRolPermiso.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelRolPermiso.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelRolPermiso.php'; +require_once 'lib/model/om/BaseRelRolPermiso.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelRolPermisoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelRolPermisoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelRolPermisoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelRolPermisoPeer.php'; + require_once 'lib/model/om/BaseRelRolPermisoPeer.php'; // include object class - include_once 'model/RelRolPermiso.php'; + include_once 'lib/model/RelRolPermiso.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelUsuarioPermiso.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelUsuarioPermiso.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelUsuarioPermiso.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelUsuarioPermiso.php'; +require_once 'lib/model/om/BaseRelUsuarioPermiso.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelUsuarioPermisoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelUsuarioPermisoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelUsuarioPermisoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + require_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; // include object class - include_once 'model/RelUsuarioPermiso.php'; + include_once 'lib/model/RelUsuarioPermiso.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRelUsuarioPreferencia.php'; +require_once 'lib/model/om/BaseRelUsuarioPreferencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RelUsuarioPreferenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRelUsuarioPreferenciaPeer.php'; + require_once 'lib/model/om/BaseRelUsuarioPreferenciaPeer.php'; // include object class - include_once 'model/RelUsuarioPreferencia.php'; + include_once 'lib/model/RelUsuarioPreferencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Repeticion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Repeticion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Repeticion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRepeticion.php'; +require_once 'lib/model/om/BaseRepeticion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RepeticionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RepeticionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RepeticionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRepeticionPeer.php'; + require_once 'lib/model/om/BaseRepeticionPeer.php'; // include object class - include_once 'model/Repeticion.php'; + include_once 'lib/model/Repeticion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Responsable.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Responsable.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Responsable.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseResponsable.php'; +require_once 'lib/model/om/BaseResponsable.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/ResponsablePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/ResponsablePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/ResponsablePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseResponsablePeer.php'; + require_once 'lib/model/om/BaseResponsablePeer.php'; // include object class - include_once 'model/Responsable.php'; + include_once 'lib/model/Responsable.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Rol.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Rol.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Rol.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseRol.php'; +require_once 'lib/model/om/BaseRol.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/RolPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/RolPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/RolPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseRolPeer.php'; + require_once 'lib/model/om/BaseRolPeer.php'; // include object class - include_once 'model/Rol.php'; + include_once 'lib/model/Rol.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Tipoasistencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Tipoasistencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Tipoasistencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTipoasistencia.php'; +require_once 'lib/model/om/BaseTipoasistencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TipoasistenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TipoasistenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TipoasistenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTipoasistenciaPeer.php'; + require_once 'lib/model/om/BaseTipoasistenciaPeer.php'; // include object class - include_once 'model/Tipoasistencia.php'; + include_once 'lib/model/Tipoasistencia.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Tipodocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Tipodocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Tipodocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTipodocente.php'; +require_once 'lib/model/om/BaseTipodocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TipodocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TipodocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TipodocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTipodocentePeer.php'; + require_once 'lib/model/om/BaseTipodocentePeer.php'; // include object class - include_once 'model/Tipodocente.php'; + include_once 'lib/model/Tipodocente.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Tipodocumento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Tipodocumento.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Tipodocumento.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTipodocumento.php'; +require_once 'lib/model/om/BaseTipodocumento.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TipodocumentoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TipodocumentoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TipodocumentoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTipodocumentoPeer.php'; + require_once 'lib/model/om/BaseTipodocumentoPeer.php'; // include object class - include_once 'model/Tipodocumento.php'; + include_once 'lib/model/Tipodocumento.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Tipoespacio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Tipoespacio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Tipoespacio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTipoespacio.php'; +require_once 'lib/model/om/BaseTipoespacio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TipoespacioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TipoespacioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TipoespacioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTipoespacioPeer.php'; + require_once 'lib/model/om/BaseTipoespacioPeer.php'; // include object class - include_once 'model/Tipoespacio.php'; + include_once 'lib/model/Tipoespacio.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Tipoiva.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Tipoiva.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Tipoiva.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTipoiva.php'; +require_once 'lib/model/om/BaseTipoiva.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TipoivaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TipoivaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TipoivaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTipoivaPeer.php'; + require_once 'lib/model/om/BaseTipoivaPeer.php'; // include object class - include_once 'model/Tipoiva.php'; + include_once 'lib/model/Tipoiva.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Tipolocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Tipolocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Tipolocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTipolocacion.php'; +require_once 'lib/model/om/BaseTipolocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TipolocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TipolocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TipolocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTipolocacionPeer.php'; + require_once 'lib/model/om/BaseTipolocacionPeer.php'; // include object class - include_once 'model/Tipolocacion.php'; + include_once 'lib/model/Tipolocacion.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Turnos.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Turnos.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Turnos.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseTurnos.php'; +require_once 'lib/model/om/BaseTurnos.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/TurnosPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/TurnosPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/TurnosPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseTurnosPeer.php'; + require_once 'lib/model/om/BaseTurnosPeer.php'; // include object class - include_once 'model/Turnos.php'; + include_once 'lib/model/Turnos.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/Usuario.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Usuario.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/Usuario.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,6 +1,6 @@ <?php -require_once 'model/om/BaseUsuario.php'; +require_once 'lib/model/om/BaseUsuario.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/UsuarioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/UsuarioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/UsuarioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,10 +1,10 @@ <?php // include base peer class - require_once 'model/om/BaseUsuarioPeer.php'; + require_once 'lib/model/om/BaseUsuarioPeer.php'; // include object class - include_once 'model/Usuario.php'; + include_once 'lib/model/Usuario.php'; /** Modified: prosistem/alba/trunk/alba/lib/model/map/ActividadMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ActividadMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ActividadMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'actividad' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ActividadMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ActividadMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ActividadMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,10 +36,9 @@ $tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // ActividadMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/AdjuntoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/AdjuntoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/AdjuntoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'adjunto' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class AdjuntoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.AdjuntoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.AdjuntoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,18 +34,17 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('NOMBRE_ARCHIVO', 'NombreArchivo', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE_ARCHIVO', 'NombreArchivo', 'string', CreoleTypes::VARCHAR, true, 255); - $tMap->addColumn('TIPO_ARCHIVO', 'TipoArchivo', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('TIPO_ARCHIVO', 'TipoArchivo', 'string', CreoleTypes::VARCHAR, true, 64); - $tMap->addColumn('RUTA', 'Ruta', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('RUTA', 'Ruta', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, true); - } // doBuild() - -} // AdjuntoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/AlumnoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/AlumnoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/AlumnoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'alumno' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class AlumnoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.AlumnoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.AlumnoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,31 +34,31 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('APELLIDO', 'Apellido', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('APELLIDO', 'Apellido', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addColumn('FECHA_NACIMIENTO', 'FechaNacimiento', 'int', CreoleTypes::TIMESTAMP, true); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, true, 20); $tMap->addForeignKey('FK_PROVINCIA_ID', 'FkProvinciaId', 'int', CreoleTypes::INTEGER, 'provincia', 'ID', true, null); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('LUGAR_NACIMIENTO', 'LugarNacimiento', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('LUGAR_NACIMIENTO', 'LugarNacimiento', 'string', CreoleTypes::VARCHAR, false, 128); $tMap->addForeignKey('FK_TIPODOCUMENTO_ID', 'FkTipodocumentoId', 'int', CreoleTypes::INTEGER, 'tipodocumento', 'ID', true, 11); - $tMap->addColumn('NRO_DOCUMENTO', 'NroDocumento', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NRO_DOCUMENTO', 'NroDocumento', 'string', CreoleTypes::VARCHAR, true, 16); $tMap->addColumn('SEXO', 'Sexo', 'string', CreoleTypes::CHAR, true); - $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addColumn('DISTANCIA_ESCUELA', 'DistanciaEscuela', 'int', CreoleTypes::INTEGER, false); @@ -110,6 +78,5 @@ $tMap->addForeignKey('FK_PAIS_ID', 'FkPaisId', 'int', CreoleTypes::INTEGER, 'pais', 'ID', true, null); - } // doBuild() - -} // AlumnoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/AnioMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/AnioMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/AnioMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'anio' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class AnioMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.AnioMapBuilder'; + + const CLASS_NAME = 'lib.model.map.AnioMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,8 +36,7 @@ $tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, 11); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); - } // doBuild() - -} // AnioMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/AsistenciaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/AsistenciaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/AsistenciaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'asistencia' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class AsistenciaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.AsistenciaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.AsistenciaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -72,6 +40,5 @@ $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, true); - } // doBuild() - -} // AsistenciaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/BoletinActividadesMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/BoletinActividadesMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/BoletinActividadesMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'boletin_actividades' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class BoletinActividadesMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.BoletinActividadesMapBuilder'; + + const CLASS_NAME = 'lib.model.map.BoletinActividadesMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -78,6 +46,5 @@ $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, true); - } // doBuild() - -} // BoletinActividadesMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/BoletinConceptualMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/BoletinConceptualMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/BoletinConceptualMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'boletin_conceptual' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class BoletinConceptualMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.BoletinConceptualMapBuilder'; + + const CLASS_NAME = 'lib.model.map.BoletinConceptualMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -78,6 +46,5 @@ $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, true); - } // doBuild() - -} // BoletinConceptualMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/CalendariovacunacionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/CalendariovacunacionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/CalendariovacunacionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'calendariovacunacion' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class CalendariovacunacionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.CalendariovacunacionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.CalendariovacunacionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,14 +34,13 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('PERIODO', 'Periodo', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('PERIODO', 'Periodo', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // CalendariovacunacionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/CargobajaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/CargobajaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/CargobajaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'cargobaja' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class CargobajaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.CargobajaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.CargobajaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // CargobajaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/CiclolectivoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/CiclolectivoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/CiclolectivoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'ciclolectivo' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class CiclolectivoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.CiclolectivoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.CiclolectivoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -72,10 +40,9 @@ $tMap->addColumn('FECHA_FIN', 'FechaFin', 'int', CreoleTypes::TIMESTAMP, true); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('ACTUAL', 'Actual', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // CiclolectivoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/ConceptoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ConceptoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ConceptoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'concepto' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ConceptoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ConceptoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ConceptoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,10 +36,9 @@ $tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // ConceptoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/ConceptobajaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ConceptobajaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ConceptobajaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'conceptobaja' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ConceptobajaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ConceptobajaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ConceptobajaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // ConceptobajaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/CuentaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/CuentaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/CuentaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'cuenta' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class CuentaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.CuentaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.CuentaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,24 +34,23 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('RAZON_SOCIAL', 'RazonSocial', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('RAZON_SOCIAL', 'RazonSocial', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CUIT', 'Cuit', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CUIT', 'Cuit', 'string', CreoleTypes::VARCHAR, true, 20); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, true, 20); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); $tMap->addForeignKey('FK_PROVINCIA_ID', 'FkProvinciaId', 'int', CreoleTypes::INTEGER, 'provincia', 'ID', true, null); $tMap->addForeignKey('FK_TIPOIVA_ID', 'FkTipoivaId', 'int', CreoleTypes::INTEGER, 'tipoiva', 'ID', true, null); - } // doBuild() - -} // CuentaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/DistritoescolarMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/DistritoescolarMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/DistritoescolarMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'distritoescolar' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class DistritoescolarMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.DistritoescolarMapBuilder'; + + const CLASS_NAME = 'lib.model.map.DistritoescolarMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,14 +34,13 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, false, 128); - } // doBuild() - -} // DistritoescolarMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/DivisionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/DivisionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/DivisionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'division' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class DivisionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.DivisionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.DivisionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,10 +36,9 @@ $tMap->addForeignKey('FK_ANIO_ID', 'FkAnioId', 'int', CreoleTypes::INTEGER, 'anio', 'ID', true, 11); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addForeignKey('FK_TURNOS_ID', 'FkTurnosId', 'int', CreoleTypes::INTEGER, 'turnos', 'ID', true, 11); - } // doBuild() - -} // DivisionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'docente_horario' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class DocenteHorarioMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.DocenteHorarioMapBuilder'; + + const CLASS_NAME = 'lib.model.map.DocenteHorarioMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -76,6 +44,5 @@ $tMap->addColumn('DIA', 'Dia', 'int', CreoleTypes::INTEGER, true); - } // doBuild() - -} // DocenteHorarioMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/DocenteMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/DocenteMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/DocenteMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'docente' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class DocenteMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.DocenteMapBuilder'; + + const CLASS_NAME = 'lib.model.map.DocenteMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,9 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('APELLIDO', 'Apellido', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('APELLIDO', 'Apellido', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addColumn('SEXO', 'Sexo', 'string', CreoleTypes::CHAR, false); @@ -76,21 +44,21 @@ $tMap->addForeignKey('FK_TIPODOCUMENTO_ID', 'FkTipodocumentoId', 'int', CreoleTypes::INTEGER, 'tipodocumento', 'ID', true, 11); - $tMap->addColumn('NRO_DOCUMENTO', 'NroDocumento', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NRO_DOCUMENTO', 'NroDocumento', 'string', CreoleTypes::VARCHAR, true, 16); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('TELEFONO_MOVIL', 'TelefonoMovil', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO_MOVIL', 'TelefonoMovil', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addColumn('LIBRETA_SANITARIA', 'LibretaSanitaria', 'boolean', CreoleTypes::BOOLEAN, false); @@ -100,6 +68,5 @@ $tMap->addForeignKey('FK_PROVINCIA_ID', 'FkProvinciaId', 'int', CreoleTypes::INTEGER, 'provincia', 'ID', true, 11); - } // doBuild() - -} // DocenteMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/EscalanotaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/EscalanotaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/EscalanotaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'escalanota' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class EscalanotaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.EscalanotaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.EscalanotaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,14 +36,13 @@ $tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('ORDEN', 'Orden', 'int', CreoleTypes::INTEGER, true); $tMap->addColumn('APROBADO', 'Aprobado', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // EscalanotaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/EspacioMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/EspacioMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/EspacioMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'espacio' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class EspacioMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.EspacioMapBuilder'; + + const CLASS_NAME = 'lib.model.map.EspacioMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,20 +34,19 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addColumn('M2', 'M2', 'double', CreoleTypes::FLOAT, false); - $tMap->addColumn('CAPACIDAD', 'Capacidad', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CAPACIDAD', 'Capacidad', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('ESTADO', 'Estado', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('ESTADO', 'Estado', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('FK_TIPOESPACIO_ID', 'FkTipoespacioId', 'int', CreoleTypes::INTEGER, 'tipoespacio', 'ID', false, 11); $tMap->addForeignKey('FK_LOCACION_ID', 'FkLocacionId', 'int', CreoleTypes::INTEGER, 'locacion', 'ID', true, null); - } // doBuild() - -} // EspacioMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/EstablecimientoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/EstablecimientoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/EstablecimientoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'establecimiento' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class EstablecimientoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.EstablecimientoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.EstablecimientoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,9 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('FK_DISTRITOESCOLAR_ID', 'FkDistritoescolarId', 'int', CreoleTypes::INTEGER, 'distritoescolar', 'ID', true, null); @@ -76,6 +44,5 @@ $tMap->addForeignKey('FK_NIVELTIPO_ID', 'FkNiveltipoId', 'int', CreoleTypes::INTEGER, 'niveltipo', 'ID', true, null); - } // doBuild() - -} // EstablecimientoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/ExamenMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ExamenMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ExamenMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'examen' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ExamenMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ExamenMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ExamenMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -74,12 +42,11 @@ $tMap->addForeignKey('FK_PERIODO_ID', 'FkPeriodoId', 'int', CreoleTypes::INTEGER, 'periodo', 'ID', true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::BLOB, true); $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, true); - } // doBuild() - -} // ExamenMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/FeriadoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/FeriadoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/FeriadoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'feriado' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class FeriadoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.FeriadoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.FeriadoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,7 +34,7 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, true); @@ -76,6 +44,5 @@ $tMap->addForeignKey('FK_CICLOLECTIVO_ID', 'FkCiclolectivoId', 'int', CreoleTypes::INTEGER, 'ciclolectivo', 'ID', true, 11); - } // doBuild() - -} // FeriadoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'horarioescolar' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class HorarioescolarMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.HorarioescolarMapBuilder'; + + const CLASS_NAME = 'lib.model.map.HorarioescolarMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -72,9 +40,9 @@ $tMap->addColumn('HORA_FIN', 'HoraFin', 'int', CreoleTypes::TIME, true); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, null); @@ -82,6 +50,5 @@ $tMap->addForeignKey('FK_HORARIOESCOLARTIPO_ID', 'FkHorarioescolartipoId', 'int', CreoleTypes::INTEGER, 'horarioescolartipo', 'ID', true, null); - } // doBuild() - -} // HorarioescolarMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/HorarioescolartipoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/HorarioescolartipoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/HorarioescolartipoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'horarioescolartipo' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class HorarioescolartipoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.HorarioescolartipoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.HorarioescolartipoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // HorarioescolartipoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/LegajoadjuntoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/LegajoadjuntoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/LegajoadjuntoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'legajoadjunto' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class LegajoadjuntoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.LegajoadjuntoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.LegajoadjuntoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,6 +36,5 @@ $tMap->addForeignKey('FK_ADJUNTO_ID', 'FkAdjuntoId', 'int', CreoleTypes::INTEGER, 'adjunto', 'ID', true, 11); - } // doBuild() - -} // LegajoadjuntoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/LegajocategoriaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/LegajocategoriaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/LegajocategoriaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'legajocategoria' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class LegajocategoriaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.LegajocategoriaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.LegajocategoriaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,8 +34,7 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); - } // doBuild() - -} // LegajocategoriaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/LegajopedagogicoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/LegajopedagogicoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/LegajopedagogicoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'legajopedagogico' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class LegajopedagogicoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.LegajopedagogicoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.LegajopedagogicoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,7 +36,7 @@ $tMap->addForeignKey('FK_ALUMNO_ID', 'FkAlumnoId', 'int', CreoleTypes::INTEGER, 'alumno', 'ID', true, 11); - $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('RESUMEN', 'Resumen', 'string', CreoleTypes::BLOB, true); @@ -80,6 +48,5 @@ $tMap->addForeignKey('FK_LEGAJOCATEGORIA_ID', 'FkLegajocategoriaId', 'int', CreoleTypes::INTEGER, 'legajocategoria', 'ID', true, 11); - } // doBuild() - -} // LegajopedagogicoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/LocacionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/LocacionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/LocacionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'locacion' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class LocacionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.LocacionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.LocacionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,30 +34,29 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, false, 20); $tMap->addForeignKey('FK_PROVINCIA_ID', 'FkProvinciaId', 'int', CreoleTypes::INTEGER, 'provincia', 'ID', true, null); $tMap->addForeignKey('FK_TIPOLOCACION_ID', 'FkTipolocacionId', 'int', CreoleTypes::INTEGER, 'tipolocacion', 'ID', true, null); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('FAX', 'Fax', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('FAX', 'Fax', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('ENCARGADO', 'Encargado', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('ENCARGADO', 'Encargado', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('ENCARGADO_TELEFONO', 'EncargadoTelefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('ENCARGADO_TELEFONO', 'EncargadoTelefono', 'string', CreoleTypes::VARCHAR, false, 20); $tMap->addColumn('PRINCIPAL', 'Principal', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // LocacionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/MenuMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/MenuMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/MenuMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'menu' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class MenuMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.MenuMapBuilder'; + + const CLASS_NAME = 'lib.model.map.MenuMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,18 +34,17 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 255); - $tMap->addColumn('LINK', 'Link', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('LINK', 'Link', 'string', CreoleTypes::VARCHAR, true, 255); - $tMap->addColumn('PERM', 'Perm', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('PERM', 'Perm', 'string', CreoleTypes::VARCHAR, true, 255); - $tMap->addColumn('TARGET', 'Target', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('TARGET', 'Target', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addForeignKey('FK_PADRE_MENU_ID', 'FkPadreMenuId', 'int', CreoleTypes::INTEGER, 'menu', 'ID', false, null); $tMap->addColumn('ORDEN', 'Orden', 'int', CreoleTypes::INTEGER, false); - } // doBuild() - -} // MenuMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/ModuloMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ModuloMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ModuloMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'modulo' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ModuloMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ModuloMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ModuloMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,14 +34,13 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TITULO', 'Titulo', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('ACTIVO', 'Activo', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // ModuloMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/NiveltipoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/NiveltipoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/NiveltipoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'niveltipo' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class NiveltipoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.NiveltipoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.NiveltipoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // NiveltipoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/OrganizacionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/OrganizacionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/OrganizacionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'organizacion' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class OrganizacionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.OrganizacionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.OrganizacionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,26 +34,25 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - $tMap->addColumn('RAZON_SOCIAL', 'RazonSocial', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('RAZON_SOCIAL', 'RazonSocial', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CUIT', 'Cuit', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CUIT', 'Cuit', 'string', CreoleTypes::VARCHAR, true, 20); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, true, 20); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); $tMap->addForeignKey('FK_PROVINCIA_ID', 'FkProvinciaId', 'int', CreoleTypes::INTEGER, 'provincia', 'ID', true, null); $tMap->addForeignKey('FK_TIPOIVA_ID', 'FkTipoivaId', 'int', CreoleTypes::INTEGER, 'tipoiva', 'ID', true, null); - } // doBuild() - -} // OrganizacionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/PaisMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/PaisMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/PaisMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'pais' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class PaisMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.PaisMapBuilder'; + + const CLASS_NAME = 'lib.model.map.PaisMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,12 +34,11 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE_LARGO', 'NombreLargo', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE_LARGO', 'NombreLargo', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('NOMBRE_CORTO', 'NombreCorto', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE_CORTO', 'NombreCorto', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('ORDEN', 'Orden', 'int', CreoleTypes::INTEGER, false); - } // doBuild() - -} // PaisMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/PeriodoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/PeriodoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/PeriodoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'periodo' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class PeriodoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.PeriodoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.PeriodoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -72,8 +40,7 @@ $tMap->addColumn('FECHA_FIN', 'FechaFin', 'int', CreoleTypes::TIMESTAMP, true); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); - } // doBuild() - -} // PeriodoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/PermisoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/PermisoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/PermisoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'permiso' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class PermisoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.PermisoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.PermisoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,14 +34,13 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('FK_MODULO_ID', 'FkModuloId', 'int', CreoleTypes::INTEGER, 'modulo', 'ID', true, null); - $tMap->addColumn('CREDENCIAL', 'Credencial', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CREDENCIAL', 'Credencial', 'string', CreoleTypes::VARCHAR, false, 32); - } // doBuild() - -} // PermisoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/PreferenciaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/PreferenciaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/PreferenciaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'preferencia' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class PreferenciaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.PreferenciaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.PreferenciaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,12 +34,11 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('VALOR_POR_DEFECTO', 'ValorPorDefecto', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('VALOR_POR_DEFECTO', 'ValorPorDefecto', 'string', CreoleTypes::VARCHAR, false, 128); $tMap->addColumn('ACTIVO', 'Activo', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // PreferenciaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/ProvinciaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ProvinciaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ProvinciaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'provincia' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ProvinciaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ProvinciaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ProvinciaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,14 +34,13 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE_CORTO', 'NombreCorto', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE_CORTO', 'NombreCorto', 'string', CreoleTypes::VARCHAR, true, 32); - $tMap->addColumn('NOMBRE_LARGO', 'NombreLargo', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE_LARGO', 'NombreLargo', 'string', CreoleTypes::VARCHAR, true, 128); $tMap->addForeignKey('FK_PAIS_ID', 'FkPaisId', 'int', CreoleTypes::INTEGER, 'pais', 'ID', true, null); $tMap->addColumn('ORDEN', 'Orden', 'int', CreoleTypes::INTEGER, false); - } // doBuild() - -} // ProvinciaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelActividadDocenteMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelActividadDocenteMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelActividadDocenteMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_actividad_docente' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelActividadDocenteMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelActividadDocenteMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelActividadDocenteMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,6 +38,5 @@ $tMap->addForeignKey('FK_DOCENTE_ID', 'FkDocenteId', 'int', CreoleTypes::INTEGER, 'docente', 'ID', true, 11); - } // doBuild() - -} // RelActividadDocenteMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelAlumnoDivisionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelAlumnoDivisionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelAlumnoDivisionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_alumno_division' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelAlumnoDivisionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelAlumnoDivisionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelAlumnoDivisionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,6 +38,5 @@ $tMap->addForeignKey('FK_ALUMNO_ID', 'FkAlumnoId', 'int', CreoleTypes::INTEGER, 'alumno', 'ID', true, 11); - } // doBuild() - -} // RelAlumnoDivisionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelAnioActividadMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelAnioActividadMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelAnioActividadMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_anio_actividad' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelAnioActividadMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelAnioActividadMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelAnioActividadMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -72,6 +40,5 @@ $tMap->addColumn('HORAS', 'Horas', 'double', CreoleTypes::DECIMAL, true); - } // doBuild() - -} // RelAnioActividadMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelCalendariovacunacionAlumnoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelCalendariovacunacionAlumnoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelCalendariovacunacionAlumnoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_calendariovacunacion_alumno' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelCalendariovacunacionAlumnoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelCalendariovacunacionAlumnoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelCalendariovacunacionAlumnoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,12 +38,11 @@ $tMap->addForeignKey('FK_CALENDARIOVACUNACION_ID', 'FkCalendariovacunacionId', 'int', CreoleTypes::INTEGER, 'calendariovacunacion', 'ID', true, 11); - $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('COMPROBANTE', 'Comprobante', 'boolean', CreoleTypes::BOOLEAN, true); $tMap->addColumn('FECHA', 'Fecha', 'int', CreoleTypes::TIMESTAMP, false); - } // doBuild() - -} // RelCalendariovacunacionAlumnoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelDivisionActividadDocenteMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelDivisionActividadDocenteMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelDivisionActividadDocenteMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_division_actividad_docente' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelDivisionActividadDocenteMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelDivisionActividadDocenteMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelDivisionActividadDocenteMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -86,6 +54,5 @@ $tMap->addColumn('HORA_FIN', 'HoraFin', 'int', CreoleTypes::TIME, true); - } // doBuild() - -} // RelDivisionActividadDocenteMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelDocenteEstablecimientoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelDocenteEstablecimientoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelDocenteEstablecimientoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_docente_establecimiento' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelDocenteEstablecimientoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelDocenteEstablecimientoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelDocenteEstablecimientoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -68,6 +36,5 @@ $tMap->addForeignKey('FK_DOCENTE_ID', 'FkDocenteId', 'int', CreoleTypes::INTEGER, 'docente', 'ID', true, 11); - } // doBuild() - -} // RelDocenteEstablecimientoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelEstablecimientoLocacionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelEstablecimientoLocacionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelEstablecimientoLocacionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_establecimiento_locacion' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelEstablecimientoLocacionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelEstablecimientoLocacionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelEstablecimientoLocacionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,6 +38,5 @@ $tMap->addForeignKey('FK_LOCACION_ID', 'FkLocacionId', 'int', CreoleTypes::INTEGER, 'locacion', 'ID', true, null); - } // doBuild() - -} // RelEstablecimientoLocacionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelRolPermisoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelRolPermisoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelRolPermisoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_rol_permiso' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelRolPermisoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelRolPermisoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelRolPermisoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,6 +38,5 @@ $tMap->addForeignKey('FK_PERMISO_ID', 'FkPermisoId', 'int', CreoleTypes::INTEGER, 'permiso', 'ID', true, null); - } // doBuild() - -} // RelRolPermisoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPermisoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPermisoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPermisoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_usuario_permiso' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelUsuarioPermisoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelUsuarioPermisoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelUsuarioPermisoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,6 +38,5 @@ $tMap->addForeignKey('FK_PERMISO_ID', 'FkPermisoId', 'int', CreoleTypes::INTEGER, 'permiso', 'ID', true, null); - } // doBuild() - -} // RelUsuarioPermisoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPreferenciaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPreferenciaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RelUsuarioPreferenciaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rel_usuario_preferencia' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RelUsuarioPreferenciaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RelUsuarioPreferenciaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RelUsuarioPreferenciaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -70,6 +38,5 @@ $tMap->addColumn('FK_PREFERENCIA_ID', 'FkPreferenciaId', 'int', CreoleTypes::INTEGER, true); - } // doBuild() - -} // RelUsuarioPreferenciaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RepeticionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RepeticionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RepeticionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'repeticion' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RepeticionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RepeticionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RepeticionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('ORDEN', 'Orden', 'int', CreoleTypes::INTEGER, true); - } // doBuild() - -} // RepeticionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/ResponsableMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/ResponsableMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/ResponsableMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'responsable' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class ResponsableMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.ResponsableMapBuilder'; + + const CLASS_NAME = 'lib.model.map.ResponsableMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,38 +34,37 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('APELLIDO', 'Apellido', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('APELLIDO', 'Apellido', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DIRECCION', 'Direccion', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CIUDAD', 'Ciudad', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('CODIGO_POSTAL', 'CodigoPostal', 'string', CreoleTypes::VARCHAR, false, 20); $tMap->addForeignKey('FK_PROVINCIA_ID', 'FkProvinciaId', 'int', CreoleTypes::INTEGER, 'provincia', 'ID', true, null); - $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO', 'Telefono', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('TELEFONO_MOVIL', 'TelefonoMovil', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('TELEFONO_MOVIL', 'TelefonoMovil', 'string', CreoleTypes::VARCHAR, false, 20); - $tMap->addColumn('NRO_DOCUMENTO', 'NroDocumento', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NRO_DOCUMENTO', 'NroDocumento', 'string', CreoleTypes::VARCHAR, true, 20); $tMap->addForeignKey('FK_TIPODOCUMENTO_ID', 'FkTipodocumentoId', 'int', CreoleTypes::INTEGER, 'tipodocumento', 'ID', true, null); $tMap->addColumn('SEXO', 'Sexo', 'string', CreoleTypes::CHAR, true); - $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('RELACION', 'Relacion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('RELACION', 'Relacion', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('OBSERVACION', 'Observacion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('AUTORIZACION_RETIRO', 'AutorizacionRetiro', 'boolean', CreoleTypes::BOOLEAN, true); $tMap->addForeignKey('FK_CUENTA_ID', 'FkCuentaId', 'int', CreoleTypes::INTEGER, 'cuenta', 'ID', true, null); - } // doBuild() - -} // ResponsableMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/RolMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/RolMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/RolMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'rol' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class RolMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.RolMapBuilder'; + + const CLASS_NAME = 'lib.model.map.RolMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,12 +34,11 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('ACTIVO', 'Activo', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // RolMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TipoasistenciaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TipoasistenciaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TipoasistenciaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'tipoasistencia' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TipoasistenciaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TipoasistenciaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TipoasistenciaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,16 +34,15 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 10); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('VALOR', 'Valor', 'double', CreoleTypes::DECIMAL, true); - $tMap->addColumn('GRUPO', 'Grupo', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('GRUPO', 'Grupo', 'string', CreoleTypes::VARCHAR, false, 30); $tMap->addColumn('DEFECTO', 'Defecto', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // TipoasistenciaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TipodocenteMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TipodocenteMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TipodocenteMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'tipodocente' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TipodocenteMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TipodocenteMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TipodocenteMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // TipodocenteMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TipodocumentoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TipodocumentoMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TipodocumentoMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'tipodocumento' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TipodocumentoMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TipodocumentoMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TipodocumentoMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,12 +34,11 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('ORDEN', 'Orden', 'int', CreoleTypes::INTEGER, false); - } // doBuild() - -} // TipodocumentoMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TipoespacioMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TipoespacioMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TipoespacioMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'tipoespacio' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TipoespacioMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TipoespacioMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TipoespacioMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // TipoespacioMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TipoivaMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TipoivaMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TipoivaMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'tipoiva' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TipoivaMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TipoivaMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TipoivaMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // TipoivaMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TipolocacionMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TipolocacionMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TipolocacionMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'tipolocacion' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TipolocacionMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TipolocacionMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TipolocacionMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,10 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('NOMBRE', 'Nombre', 'string', CreoleTypes::VARCHAR, true, 128); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255); - } // doBuild() - -} // TipolocacionMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/TurnosMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/TurnosMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/TurnosMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'turnos' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class TurnosMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.TurnosMapBuilder'; + + const CLASS_NAME = 'lib.model.map.TurnosMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -72,8 +40,7 @@ $tMap->addColumn('HORA_FIN', 'HoraFin', 'int', CreoleTypes::TIME, true); - $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, true, 255); - } // doBuild() - -} // TurnosMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/map/UsuarioMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/UsuarioMapBuilder.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/map/UsuarioMapBuilder.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,28 @@ <?php - -require_once 'propel/map/MapBuilder.php'; -include_once 'creole/CreoleTypes.php'; -/** - * This class adds structure of 'usuario' table to 'alba' DatabaseMap object. - * - * - * - * These statically-built map classes are used by Propel to do runtime db structure discovery. - * For example, the createSelectSql() method checks the type of a given column used in an - * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive - * (i.e. if it's a text column type). - * - * @package model.map - */ + class UsuarioMapBuilder { - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = 'model.map.UsuarioMapBuilder'; + + const CLASS_NAME = 'lib.model.map.UsuarioMapBuilder'; - /** - * The database map. - */ + private $dbMap; - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ + public function isBuilt() { return ($this->dbMap !== null); } - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ + public function getDatabaseMap() { return $this->dbMap; } - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ + public function doBuild() { $this->dbMap = Propel::getDatabaseMap('alba'); @@ -66,9 +34,9 @@ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); - $tMap->addColumn('USUARIO', 'Usuario', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('USUARIO', 'Usuario', 'string', CreoleTypes::VARCHAR, true, 32); - $tMap->addColumn('CLAVE', 'Clave', 'string', CreoleTypes::VARCHAR, true); + $tMap->addColumn('CLAVE', 'Clave', 'string', CreoleTypes::VARCHAR, true, 48); $tMap->addColumn('CORREO_PUBLICO', 'CorreoPublico', 'boolean', CreoleTypes::BOOLEAN, false); @@ -78,16 +46,15 @@ $tMap->addColumn('FECHA_ACTUALIZADO', 'FechaActualizado', 'int', CreoleTypes::TIMESTAMP, true); - $tMap->addColumn('SEGURIDAD_PREGUNTA', 'SeguridadPregunta', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('SEGURIDAD_PREGUNTA', 'SeguridadPregunta', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('SEGURIDAD_RESPUESTA', 'SeguridadRespuesta', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('SEGURIDAD_RESPUESTA', 'SeguridadRespuesta', 'string', CreoleTypes::VARCHAR, false, 128); - $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false); + $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false, 128); $tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, null); $tMap->addColumn('BORRADO', 'Borrado', 'boolean', CreoleTypes::BOOLEAN, true); - } // doBuild() - -} // UsuarioMapBuilder + } +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseActividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseActividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseActividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,189 +1,96 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ActividadPeer.php'; - -/** - * Base class that represents a row from the 'actividad' table. - * - * - * - * @package model.om - */ abstract class BaseActividad extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ActividadPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Collection to store aggregation of collBoletinActividadess. - * @var array - */ + protected $collBoletinActividadess; - /** - * The criteria used to select the current contents of collBoletinActividadess. - * @var Criteria - */ + protected $lastBoletinActividadesCriteria = null; - /** - * Collection to store aggregation of collExamens. - * @var array - */ + protected $collExamens; - /** - * The criteria used to select the current contents of collExamens. - * @var Criteria - */ + protected $lastExamenCriteria = null; - /** - * Collection to store aggregation of collRelAnioActividads. - * @var array - */ + protected $collRelAnioActividads; - /** - * The criteria used to select the current contents of collRelAnioActividads. - * @var Criteria - */ + protected $lastRelAnioActividadCriteria = null; - /** - * Collection to store aggregation of collRelDivisionActividadDocentes. - * @var array - */ + protected $collRelDivisionActividadDocentes; - /** - * The criteria used to select the current contents of collRelDivisionActividadDocentes. - * @var Criteria - */ + protected $lastRelDivisionActividadDocenteCriteria = null; - /** - * Collection to store aggregation of collRelActividadDocentes. - * @var array - */ + protected $collRelActividadDocentes; - /** - * The criteria used to select the current contents of collRelActividadDocentes. - * @var Criteria - */ + protected $lastRelActividadDocenteCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -192,14 +99,8 @@ $this->modifiedColumns[] = ActividadPeer::ID; } - } // setId() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -212,14 +113,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -228,14 +123,8 @@ $this->modifiedColumns[] = ActividadPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -244,21 +133,8 @@ $this->modifiedColumns[] = ActividadPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -275,23 +151,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = ActividadPeer::NUM_COLUMNS - ActividadPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Actividad object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -313,16 +179,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -344,29 +201,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -375,22 +217,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ActividadPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ActividadPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collBoletinActividadess !== null) { foreach($this->collBoletinActividadess as $referrerFK) { @@ -435,37 +271,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -478,16 +294,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -497,11 +304,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -561,28 +364,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ActividadPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -601,19 +390,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ActividadPeer::getFieldNames($keyType); @@ -626,30 +405,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ActividadPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -665,25 +428,9 @@ case 3: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ActividadPeer::getFieldNames($keyType); @@ -694,11 +441,7 @@ if (array_key_exists($keys[3], $arr)) $this->setDescripcion($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ActividadPeer::DATABASE_NAME); @@ -711,14 +454,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ActividadPeer::DATABASE_NAME); @@ -728,36 +464,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Actividad (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -769,9 +488,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getBoletinActividadess() as $relObj) { $copyObj->addBoletinActividades($relObj->copy($deepCopy)); @@ -793,45 +510,23 @@ $copyObj->addRelActividadDocente($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Actividad Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ActividadPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -840,13 +535,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -862,41 +551,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Temporary storage of collBoletinActividadess to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinActividadess() { if ($this->collBoletinActividadess === null) { @@ -904,23 +573,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * If this Actividad is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinActividadess($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -940,13 +596,9 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinActividadesPeer::FK_ACTIVIDAD_ID, $this->getId()); BoletinActividadesPeer::addSelectColumns($criteria); @@ -959,18 +611,10 @@ return $this->collBoletinActividadess; } - /** - * Returns the number of related BoletinActividadess. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinActividadess($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -984,14 +628,7 @@ return BoletinActividadesPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinActividades object to this object - * through the BoletinActividades foreign key attribute - * - * @param BoletinActividades $l BoletinActividades - * @return void - * @throws PropelException - */ + public function addBoletinActividades(BoletinActividades $l) { $this->collBoletinActividadess[] = $l; @@ -999,21 +636,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getBoletinActividadessJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1032,10 +658,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1048,21 +671,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getBoletinActividadessJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1081,10 +693,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1097,21 +706,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getBoletinActividadessJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1130,10 +728,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1145,12 +740,7 @@ return $this->collBoletinActividadess; } - /** - * Temporary storage of collExamens to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initExamens() { if ($this->collExamens === null) { @@ -1158,23 +748,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad has previously - * been saved, it will retrieve related Examens from storage. - * If this Actividad is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getExamens($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1194,13 +771,9 @@ $this->collExamens = ExamenPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ExamenPeer::FK_ACTIVIDAD_ID, $this->getId()); ExamenPeer::addSelectColumns($criteria); @@ -1213,18 +786,10 @@ return $this->collExamens; } - /** - * Returns the number of related Examens. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countExamens($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1238,14 +803,7 @@ return ExamenPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Examen object to this object - * through the Examen foreign key attribute - * - * @param Examen $l Examen - * @return void - * @throws PropelException - */ + public function addExamen(Examen $l) { $this->collExamens[] = $l; @@ -1253,21 +811,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getExamensJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1286,10 +833,7 @@ $this->collExamens = ExamenPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1302,21 +846,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getExamensJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1335,10 +868,7 @@ $this->collExamens = ExamenPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1351,21 +881,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getExamensJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1384,10 +903,7 @@ $this->collExamens = ExamenPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1399,12 +915,7 @@ return $this->collExamens; } - /** - * Temporary storage of collRelAnioActividads to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelAnioActividads() { if ($this->collRelAnioActividads === null) { @@ -1412,23 +923,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad has previously - * been saved, it will retrieve related RelAnioActividads from storage. - * If this Actividad is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelAnioActividads($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAnioActividadPeer.php'; + include_once 'lib/model/om/BaseRelAnioActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1448,13 +946,9 @@ $this->collRelAnioActividads = RelAnioActividadPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelAnioActividadPeer::FK_ACTIVIDAD_ID, $this->getId()); RelAnioActividadPeer::addSelectColumns($criteria); @@ -1467,18 +961,10 @@ return $this->collRelAnioActividads; } - /** - * Returns the number of related RelAnioActividads. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelAnioActividads($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAnioActividadPeer.php'; + include_once 'lib/model/om/BaseRelAnioActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1492,14 +978,7 @@ return RelAnioActividadPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelAnioActividad object to this object - * through the RelAnioActividad foreign key attribute - * - * @param RelAnioActividad $l RelAnioActividad - * @return void - * @throws PropelException - */ + public function addRelAnioActividad(RelAnioActividad $l) { $this->collRelAnioActividads[] = $l; @@ -1507,21 +986,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelAnioActividads from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelAnioActividadsJoinAnio($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAnioActividadPeer.php'; + include_once 'lib/model/om/BaseRelAnioActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1540,10 +1008,7 @@ $this->collRelAnioActividads = RelAnioActividadPeer::doSelectJoinAnio($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelAnioActividadPeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelAnioActividadCriteria) || !$this->lastRelAnioActividadCriteria->equals($criteria)) { @@ -1555,12 +1020,7 @@ return $this->collRelAnioActividads; } - /** - * Temporary storage of collRelDivisionActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDivisionActividadDocentes() { if ($this->collRelDivisionActividadDocentes === null) { @@ -1568,23 +1028,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * If this Actividad is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDivisionActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1604,13 +1051,9 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); RelDivisionActividadDocentePeer::addSelectColumns($criteria); @@ -1623,18 +1066,10 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Returns the number of related RelDivisionActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDivisionActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1648,14 +1083,7 @@ return RelDivisionActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDivisionActividadDocente object to this object - * through the RelDivisionActividadDocente foreign key attribute - * - * @param RelDivisionActividadDocente $l RelDivisionActividadDocente - * @return void - * @throws PropelException - */ + public function addRelDivisionActividadDocente(RelDivisionActividadDocente $l) { $this->collRelDivisionActividadDocentes[] = $l; @@ -1663,21 +1091,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelDivisionActividadDocentesJoinDivision($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1696,10 +1113,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDivision($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1712,21 +1126,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelDivisionActividadDocentesJoinTipodocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1745,10 +1148,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinTipodocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1761,21 +1161,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelDivisionActividadDocentesJoinCargobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1794,10 +1183,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinCargobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1810,21 +1196,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelDivisionActividadDocentesJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1843,10 +1218,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1859,21 +1231,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelDivisionActividadDocentesJoinRepeticion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1892,10 +1253,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinRepeticion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1907,12 +1265,7 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Temporary storage of collRelActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelActividadDocentes() { if ($this->collRelActividadDocentes === null) { @@ -1920,23 +1273,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad has previously - * been saved, it will retrieve related RelActividadDocentes from storage. - * If this Actividad is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1956,13 +1296,9 @@ $this->collRelActividadDocentes = RelActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); RelActividadDocentePeer::addSelectColumns($criteria); @@ -1975,18 +1311,10 @@ return $this->collRelActividadDocentes; } - /** - * Returns the number of related RelActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2000,14 +1328,7 @@ return RelActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelActividadDocente object to this object - * through the RelActividadDocente foreign key attribute - * - * @param RelActividadDocente $l RelActividadDocente - * @return void - * @throws PropelException - */ + public function addRelActividadDocente(RelActividadDocente $l) { $this->collRelActividadDocentes[] = $l; @@ -2015,21 +1336,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Actividad is new, it will return - * an empty collection; or if this Actividad has previously - * been saved, it will retrieve related RelActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Actividad. - */ + public function getRelActividadDocentesJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2048,10 +1358,7 @@ $this->collRelActividadDocentes = RelActividadDocentePeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelActividadDocentePeer::FK_ACTIVIDAD_ID, $this->getId()); if (!isset($this->lastRelActividadDocenteCriteria) || !$this->lastRelActividadDocenteCriteria->equals($criteria)) { @@ -2063,4 +1370,4 @@ return $this->collRelActividadDocentes; } -} // BaseActividad +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ActividadPeer::getOMClass() -include_once 'model/Actividad.php'; -/** - * Base static class for performing query and update operations on the 'actividad' table. - * - * - * - * @package model.om - */ abstract class BaseActividadPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'actividad'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Actividad'; + + const CLASS_DEFAULT = 'lib.model.Actividad'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'actividad.ID'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'actividad.FK_ESTABLECIMIENTO_ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'actividad.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'actividad.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEstablecimientoId', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (ActividadPeer::ID, ActividadPeer::FK_ESTABLECIMIENTO_ID, ActividadPeer::NOMBRE, ActividadPeer::DESCRIPCION, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEstablecimientoId' => 1, 'Nombre' => 2, 'Descripcion' => 3, ), BasePeer::TYPE_COLNAME => array (ActividadPeer::ID => 0, ActividadPeer::FK_ESTABLECIMIENTO_ID => 1, ActividadPeer::NOMBRE => 2, ActividadPeer::DESCRIPCION => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ActividadMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ActividadMapBuilder'); + include_once 'lib/model/map/ActividadMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ActividadMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ActividadPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ActividadPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(actividad.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT actividad.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Actividad - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ActividadPeer::populateObjects(ActividadPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ ActividadPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ActividadPeer::getOMClass(); + $cls = ActividadPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -307,29 +188,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -340,25 +211,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Actividad objects pre-filled with their Establecimiento objects. - * - * @return array Array of Actividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -386,46 +249,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addActividad($obj1); //CHECKME - break; + $temp_obj2->addActividad($obj1); break; } } if ($newObject) { $obj2->initActividads(); - $obj2->addActividad($obj1); //CHECKME - } + $obj2->addActividad($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -436,25 +286,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Actividad objects pre-filled with all related objects. - * - * @return array Array of Actividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -479,8 +321,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -491,11 +332,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addActividad($obj1); // CHECKME - break; + $temp_obj2->addActividad($obj1); break; } } @@ -509,41 +348,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ActividadPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Actividad or Criteria object. - * - * @param mixed $values Criteria or Actividad object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -551,21 +368,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Actividad object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ActividadPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ActividadPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -576,15 +387,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Actividad or Criteria object. - * - * @param mixed $values Criteria or Actividad object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -594,37 +397,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ActividadPeer::ID); $selectCriteria->add(ActividadPeer::ID, $criteria->remove(ActividadPeer::ID), $comparison); - } else { // $values is Actividad object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the actividad table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ActividadPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -634,17 +425,7 @@ } } - /** - * Method perform a DELETE on the database, given a Actividad or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Actividad object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -652,25 +433,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Actividad) { + $criteria = clone $values; } elseif ($values instanceof Actividad) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ActividadPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -681,18 +456,7 @@ } } - /** - * Validates all modified columns of given Actividad object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Actividad $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Actividad $obj, $cols = null) { $columns = array(); @@ -727,13 +491,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Actividad - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -750,14 +508,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -775,20 +526,14 @@ return $objs; } -} // BaseActividadPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseActividadPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ActividadMapBuilder.php'; - Propel::registerMapBuilder('model.map.ActividadMapBuilder'); + require_once 'lib/model/map/ActividadMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ActividadMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAdjunto.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAdjunto.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAdjunto.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,191 +1,103 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/AdjuntoPeer.php'; - -/** - * Base class that represents a row from the 'adjunto' table. - * - * - * - * @package model.om - */ abstract class BaseAdjunto extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var AdjuntoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the titulo field. - * @var string - */ + protected $titulo; - /** - * The value for the nombre_archivo field. - * @var string - */ + protected $nombre_archivo; - /** - * The value for the tipo_archivo field. - * @var string - */ + protected $tipo_archivo; - /** - * The value for the ruta field. - * @var string - */ + protected $ruta; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * Collection to store aggregation of collLegajoadjuntos. - * @var array - */ + protected $collLegajoadjuntos; - /** - * The criteria used to select the current contents of collLegajoadjuntos. - * @var Criteria - */ + protected $lastLegajoadjuntoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [titulo] column value. - * - * @return string - */ + public function getTitulo() { return $this->titulo; } - /** - * Get the [nombre_archivo] column value. - * - * @return string - */ + public function getNombreArchivo() { return $this->nombre_archivo; } - /** - * Get the [tipo_archivo] column value. - * - * @return string - */ + public function getTipoArchivo() { return $this->tipo_archivo; } - /** - * Get the [ruta] column value. - * - * @return string - */ + public function getRuta() { return $this->ruta; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -199,12 +111,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -213,14 +120,8 @@ $this->modifiedColumns[] = AdjuntoPeer::ID; } - } // setId() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -229,14 +130,8 @@ $this->modifiedColumns[] = AdjuntoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [titulo] column. - * - * @param string $v new value - * @return void - */ + } + public function setTitulo($v) { @@ -245,14 +140,8 @@ $this->modifiedColumns[] = AdjuntoPeer::TITULO; } - } // setTitulo() - - /** - * Set the value of [nombre_archivo] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombreArchivo($v) { @@ -261,14 +150,8 @@ $this->modifiedColumns[] = AdjuntoPeer::NOMBRE_ARCHIVO; } - } // setNombreArchivo() - - /** - * Set the value of [tipo_archivo] column. - * - * @param string $v new value - * @return void - */ + } + public function setTipoArchivo($v) { @@ -277,14 +160,8 @@ $this->modifiedColumns[] = AdjuntoPeer::TIPO_ARCHIVO; } - } // setTipoArchivo() - - /** - * Set the value of [ruta] column. - * - * @param string $v new value - * @return void - */ + } + public function setRuta($v) { @@ -293,21 +170,14 @@ $this->modifiedColumns[] = AdjuntoPeer::RUTA; } - } // setRuta() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -317,21 +187,8 @@ $this->modifiedColumns[] = AdjuntoPeer::FECHA; } - } // setFecha() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -354,23 +211,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 7; // 7 = AdjuntoPeer::NUM_COLUMNS - AdjuntoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 7; } catch (Exception $e) { throw new PropelException("Error populating Adjunto object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -392,16 +239,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -423,40 +261,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = AdjuntoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += AdjuntoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collLegajoadjuntos !== null) { foreach($this->collLegajoadjuntos as $referrerFK) { @@ -469,37 +290,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -512,16 +313,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -551,28 +343,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = AdjuntoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -600,19 +378,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = AdjuntoPeer::getFieldNames($keyType); @@ -628,30 +396,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = AdjuntoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -676,25 +428,9 @@ case 6: $this->setFecha($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AdjuntoPeer::getFieldNames($keyType); @@ -708,11 +444,7 @@ if (array_key_exists($keys[6], $arr)) $this->setFecha($arr[$keys[6]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(AdjuntoPeer::DATABASE_NAME); @@ -728,14 +460,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(AdjuntoPeer::DATABASE_NAME); @@ -745,36 +470,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Adjunto (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -792,53 +500,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getLegajoadjuntos() as $relObj) { $copyObj->addLegajoadjunto($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Adjunto Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return AdjuntoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -847,12 +531,7 @@ return self::$peer; } - /** - * Temporary storage of collLegajoadjuntos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLegajoadjuntos() { if ($this->collLegajoadjuntos === null) { @@ -860,23 +539,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Adjunto has previously - * been saved, it will retrieve related Legajoadjuntos from storage. - * If this Adjunto is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLegajoadjuntos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajoadjuntoPeer.php'; + include_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -896,13 +562,9 @@ $this->collLegajoadjuntos = LegajoadjuntoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LegajoadjuntoPeer::FK_ADJUNTO_ID, $this->getId()); LegajoadjuntoPeer::addSelectColumns($criteria); @@ -915,18 +577,10 @@ return $this->collLegajoadjuntos; } - /** - * Returns the number of related Legajoadjuntos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLegajoadjuntos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajoadjuntoPeer.php'; + include_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -940,14 +594,7 @@ return LegajoadjuntoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Legajoadjunto object to this object - * through the Legajoadjunto foreign key attribute - * - * @param Legajoadjunto $l Legajoadjunto - * @return void - * @throws PropelException - */ + public function addLegajoadjunto(Legajoadjunto $l) { $this->collLegajoadjuntos[] = $l; @@ -955,21 +602,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Adjunto is new, it will return - * an empty collection; or if this Adjunto has previously - * been saved, it will retrieve related Legajoadjuntos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Adjunto. - */ + public function getLegajoadjuntosJoinLegajopedagogico($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajoadjuntoPeer.php'; + include_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -988,10 +624,7 @@ $this->collLegajoadjuntos = LegajoadjuntoPeer::doSelectJoinLegajopedagogico($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajoadjuntoPeer::FK_ADJUNTO_ID, $this->getId()); if (!isset($this->lastLegajoadjuntoCriteria) || !$this->lastLegajoadjuntoCriteria->equals($criteria)) { @@ -1003,4 +636,4 @@ return $this->collLegajoadjuntos; } -} // BaseAdjunto +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAdjuntoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAdjuntoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAdjuntoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,66 +1,50 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by AdjuntoPeer::getOMClass() -include_once 'model/Adjunto.php'; -/** - * Base static class for performing query and update operations on the 'adjunto' table. - * - * - * - * @package model.om - */ abstract class BaseAdjuntoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'adjunto'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Adjunto'; + + const CLASS_DEFAULT = 'lib.model.Adjunto'; - /** The total number of columns. */ + const NUM_COLUMNS = 7; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'adjunto.ID'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'adjunto.DESCRIPCION'; - /** the column name for the TITULO field */ + const TITULO = 'adjunto.TITULO'; - /** the column name for the NOMBRE_ARCHIVO field */ + const NOMBRE_ARCHIVO = 'adjunto.NOMBRE_ARCHIVO'; - /** the column name for the TIPO_ARCHIVO field */ + const TIPO_ARCHIVO = 'adjunto.TIPO_ARCHIVO'; - /** the column name for the RUTA field */ + const RUTA = 'adjunto.RUTA'; - /** the column name for the FECHA field */ + const FECHA = 'adjunto.FECHA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Descripcion', 'Titulo', 'NombreArchivo', 'TipoArchivo', 'Ruta', 'Fecha', ), BasePeer::TYPE_COLNAME => array (AdjuntoPeer::ID, AdjuntoPeer::DESCRIPCION, AdjuntoPeer::TITULO, AdjuntoPeer::NOMBRE_ARCHIVO, AdjuntoPeer::TIPO_ARCHIVO, AdjuntoPeer::RUTA, AdjuntoPeer::FECHA, ), @@ -68,12 +52,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Descripcion' => 1, 'Titulo' => 2, 'NombreArchivo' => 3, 'TipoArchivo' => 4, 'Ruta' => 5, 'Fecha' => 6, ), BasePeer::TYPE_COLNAME => array (AdjuntoPeer::ID => 0, AdjuntoPeer::DESCRIPCION => 1, AdjuntoPeer::TITULO => 2, AdjuntoPeer::NOMBRE_ARCHIVO => 3, AdjuntoPeer::TIPO_ARCHIVO => 4, AdjuntoPeer::RUTA => 5, AdjuntoPeer::FECHA => 6, ), @@ -81,24 +60,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/AdjuntoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.AdjuntoMapBuilder'); + include_once 'lib/model/map/AdjuntoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.AdjuntoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -112,15 +80,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -131,14 +91,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -148,34 +101,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. AdjuntoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(AdjuntoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -198,29 +130,19 @@ const COUNT = 'COUNT(adjunto.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT adjunto.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AdjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AdjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -229,19 +151,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Adjunto - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -252,33 +165,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return AdjuntoPeer::populateObjects(AdjuntoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -290,29 +182,18 @@ AdjuntoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = AdjuntoPeer::getOMClass(); + $cls = AdjuntoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -321,41 +202,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return AdjuntoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Adjunto or Criteria object. - * - * @param mixed $values Criteria or Adjunto object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -363,21 +222,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Adjunto object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(AdjuntoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(AdjuntoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -388,15 +241,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Adjunto or Criteria object. - * - * @param mixed $values Criteria or Adjunto object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -406,37 +251,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(AdjuntoPeer::ID); $selectCriteria->add(AdjuntoPeer::ID, $criteria->remove(AdjuntoPeer::ID), $comparison); - } else { // $values is Adjunto object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the adjunto table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(AdjuntoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -446,17 +279,7 @@ } } - /** - * Method perform a DELETE on the database, given a Adjunto or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Adjunto object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -464,25 +287,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Adjunto) { + $criteria = clone $values; } elseif ($values instanceof Adjunto) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(AdjuntoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -493,18 +310,7 @@ } } - /** - * Validates all modified columns of given Adjunto object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Adjunto $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Adjunto $obj, $cols = null) { $columns = array(); @@ -539,13 +345,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Adjunto - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -562,14 +362,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -587,20 +380,14 @@ return $objs; } -} // BaseAdjuntoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseAdjuntoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/AdjuntoMapBuilder.php'; - Propel::registerMapBuilder('model.map.AdjuntoMapBuilder'); + require_once 'lib/model/map/AdjuntoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.AdjuntoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAlumno.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAlumno.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAlumno.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,372 +1,200 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/AlumnoPeer.php'; - -/** - * Base class that represents a row from the 'alumno' table. - * - * - * - * @package model.om - */ abstract class BaseAlumno extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var AlumnoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the apellido field. - * @var string - */ + protected $apellido = ''; - /** - * The value for the fecha_nacimiento field. - * @var int - */ + protected $fecha_nacimiento; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion = ''; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad = ''; - /** - * The value for the codigo_postal field. - * @var string - */ + protected $codigo_postal = ''; - /** - * The value for the fk_provincia_id field. - * @var int - */ + protected $fk_provincia_id = 0; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono = ''; - /** - * The value for the lugar_nacimiento field. - * @var string - */ + protected $lugar_nacimiento = ''; - /** - * The value for the fk_tipodocumento_id field. - * @var int - */ + protected $fk_tipodocumento_id = 0; - /** - * The value for the nro_documento field. - * @var string - */ + protected $nro_documento = ''; - /** - * The value for the sexo field. - * @var string - */ + protected $sexo = ''; - /** - * The value for the email field. - * @var string - */ + protected $email = ''; - /** - * The value for the distancia_escuela field. - * @var int - */ + protected $distancia_escuela = 0; - /** - * The value for the hermanos_escuela field. - * @var boolean - */ + protected $hermanos_escuela = false; - /** - * The value for the hijo_maestro_escuela field. - * @var boolean - */ + protected $hijo_maestro_escuela = false; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the fk_cuenta_id field. - * @var int - */ + protected $fk_cuenta_id = 0; - /** - * The value for the certificado_medico field. - * @var boolean - */ + protected $certificado_medico = false; - /** - * The value for the activo field. - * @var boolean - */ + protected $activo = true; - /** - * The value for the fk_conceptobaja_id field. - * @var int - */ + protected $fk_conceptobaja_id; - /** - * The value for the fk_pais_id field. - * @var int - */ + protected $fk_pais_id = 0; - /** - * @var Tipodocumento - */ + protected $aTipodocumento; - /** - * @var Cuenta - */ + protected $aCuenta; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * @var Provincia - */ + protected $aProvincia; - /** - * @var Conceptobaja - */ + protected $aConceptobaja; - /** - * @var Pais - */ + protected $aPais; - /** - * Collection to store aggregation of collRelCalendariovacunacionAlumnos. - * @var array - */ + protected $collRelCalendariovacunacionAlumnos; - /** - * The criteria used to select the current contents of collRelCalendariovacunacionAlumnos. - * @var Criteria - */ + protected $lastRelCalendariovacunacionAlumnoCriteria = null; - /** - * Collection to store aggregation of collLegajopedagogicos. - * @var array - */ + protected $collLegajopedagogicos; - /** - * The criteria used to select the current contents of collLegajopedagogicos. - * @var Criteria - */ + protected $lastLegajopedagogicoCriteria = null; - /** - * Collection to store aggregation of collAsistencias. - * @var array - */ + protected $collAsistencias; - /** - * The criteria used to select the current contents of collAsistencias. - * @var Criteria - */ + protected $lastAsistenciaCriteria = null; - /** - * Collection to store aggregation of collBoletinConceptuals. - * @var array - */ + protected $collBoletinConceptuals; - /** - * The criteria used to select the current contents of collBoletinConceptuals. - * @var Criteria - */ + protected $lastBoletinConceptualCriteria = null; - /** - * Collection to store aggregation of collBoletinActividadess. - * @var array - */ + protected $collBoletinActividadess; - /** - * The criteria used to select the current contents of collBoletinActividadess. - * @var Criteria - */ + protected $lastBoletinActividadesCriteria = null; - /** - * Collection to store aggregation of collExamens. - * @var array - */ + protected $collExamens; - /** - * The criteria used to select the current contents of collExamens. - * @var Criteria - */ + protected $lastExamenCriteria = null; - /** - * Collection to store aggregation of collRelAlumnoDivisions. - * @var array - */ + protected $collRelAlumnoDivisions; - /** - * The criteria used to select the current contents of collRelAlumnoDivisions. - * @var Criteria - */ + protected $lastRelAlumnoDivisionCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [apellido] column value. - * - * @return string - */ + public function getApellido() { return $this->apellido; } - /** - * Get the [optionally formatted] [fecha_nacimiento] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaNacimiento($format = 'Y-m-d H:i:s') { if ($this->fecha_nacimiento === null || $this->fecha_nacimiento === '') { return null; } elseif (!is_int($this->fecha_nacimiento)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_nacimiento); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_nacimiento] as date/time value: " . var_export($this->fecha_nacimiento, true)); + $ts = strtotime($this->fecha_nacimiento); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_nacimiento] as date/time value: " . var_export($this->fecha_nacimiento, true)); } } else { $ts = $this->fecha_nacimiento; @@ -380,221 +208,140 @@ } } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Get the [codigo_postal] column value. - * - * @return string - */ + public function getCodigoPostal() { return $this->codigo_postal; } - /** - * Get the [fk_provincia_id] column value. - * - * @return int - */ + public function getFkProvinciaId() { return $this->fk_provincia_id; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [lugar_nacimiento] column value. - * - * @return string - */ + public function getLugarNacimiento() { return $this->lugar_nacimiento; } - /** - * Get the [fk_tipodocumento_id] column value. - * - * @return int - */ + public function getFkTipodocumentoId() { return $this->fk_tipodocumento_id; } - /** - * Get the [nro_documento] column value. - * - * @return string - */ + public function getNroDocumento() { return $this->nro_documento; } - /** - * Get the [sexo] column value. - * - * @return string - */ + public function getSexo() { return $this->sexo; } - /** - * Get the [email] column value. - * - * @return string - */ + public function getEmail() { return $this->email; } - /** - * Get the [distancia_escuela] column value. - * - * @return int - */ + public function getDistanciaEscuela() { return $this->distancia_escuela; } - /** - * Get the [hermanos_escuela] column value. - * - * @return boolean - */ + public function getHermanosEscuela() { return $this->hermanos_escuela; } - /** - * Get the [hijo_maestro_escuela] column value. - * - * @return boolean - */ + public function getHijoMaestroEscuela() { return $this->hijo_maestro_escuela; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [fk_cuenta_id] column value. - * - * @return int - */ + public function getFkCuentaId() { return $this->fk_cuenta_id; } - /** - * Get the [certificado_medico] column value. - * - * @return boolean - */ + public function getCertificadoMedico() { return $this->certificado_medico; } - /** - * Get the [activo] column value. - * - * @return boolean - */ + public function getActivo() { return $this->activo; } - /** - * Get the [fk_conceptobaja_id] column value. - * - * @return int - */ + public function getFkConceptobajaId() { return $this->fk_conceptobaja_id; } - /** - * Get the [fk_pais_id] column value. - * - * @return int - */ + public function getFkPaisId() { return $this->fk_pais_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -603,14 +350,8 @@ $this->modifiedColumns[] = AlumnoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -619,14 +360,8 @@ $this->modifiedColumns[] = AlumnoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [apellido] column. - * - * @param string $v new value - * @return void - */ + } + public function setApellido($v) { @@ -635,21 +370,14 @@ $this->modifiedColumns[] = AlumnoPeer::APELLIDO; } - } // setApellido() - - /** - * Set the value of [fecha_nacimiento] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaNacimiento($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_nacimiento] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_nacimiento] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -659,14 +387,8 @@ $this->modifiedColumns[] = AlumnoPeer::FECHA_NACIMIENTO; } - } // setFechaNacimiento() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -675,14 +397,8 @@ $this->modifiedColumns[] = AlumnoPeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -691,14 +407,8 @@ $this->modifiedColumns[] = AlumnoPeer::CIUDAD; } - } // setCiudad() - - /** - * Set the value of [codigo_postal] column. - * - * @param string $v new value - * @return void - */ + } + public function setCodigoPostal($v) { @@ -707,14 +417,8 @@ $this->modifiedColumns[] = AlumnoPeer::CODIGO_POSTAL; } - } // setCodigoPostal() - - /** - * Set the value of [fk_provincia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkProvinciaId($v) { @@ -727,14 +431,8 @@ $this->aProvincia = null; } - } // setFkProvinciaId() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -743,14 +441,8 @@ $this->modifiedColumns[] = AlumnoPeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [lugar_nacimiento] column. - * - * @param string $v new value - * @return void - */ + } + public function setLugarNacimiento($v) { @@ -759,14 +451,8 @@ $this->modifiedColumns[] = AlumnoPeer::LUGAR_NACIMIENTO; } - } // setLugarNacimiento() - - /** - * Set the value of [fk_tipodocumento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipodocumentoId($v) { @@ -779,14 +465,8 @@ $this->aTipodocumento = null; } - } // setFkTipodocumentoId() - - /** - * Set the value of [nro_documento] column. - * - * @param string $v new value - * @return void - */ + } + public function setNroDocumento($v) { @@ -795,14 +475,8 @@ $this->modifiedColumns[] = AlumnoPeer::NRO_DOCUMENTO; } - } // setNroDocumento() - - /** - * Set the value of [sexo] column. - * - * @param string $v new value - * @return void - */ + } + public function setSexo($v) { @@ -811,14 +485,8 @@ $this->modifiedColumns[] = AlumnoPeer::SEXO; } - } // setSexo() - - /** - * Set the value of [email] column. - * - * @param string $v new value - * @return void - */ + } + public function setEmail($v) { @@ -827,14 +495,8 @@ $this->modifiedColumns[] = AlumnoPeer::EMAIL; } - } // setEmail() - - /** - * Set the value of [distancia_escuela] column. - * - * @param int $v new value - * @return void - */ + } + public function setDistanciaEscuela($v) { @@ -843,14 +505,8 @@ $this->modifiedColumns[] = AlumnoPeer::DISTANCIA_ESCUELA; } - } // setDistanciaEscuela() - - /** - * Set the value of [hermanos_escuela] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setHermanosEscuela($v) { @@ -859,14 +515,8 @@ $this->modifiedColumns[] = AlumnoPeer::HERMANOS_ESCUELA; } - } // setHermanosEscuela() - - /** - * Set the value of [hijo_maestro_escuela] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setHijoMaestroEscuela($v) { @@ -875,14 +525,8 @@ $this->modifiedColumns[] = AlumnoPeer::HIJO_MAESTRO_ESCUELA; } - } // setHijoMaestroEscuela() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -895,14 +539,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [fk_cuenta_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCuentaId($v) { @@ -915,14 +553,8 @@ $this->aCuenta = null; } - } // setFkCuentaId() - - /** - * Set the value of [certificado_medico] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setCertificadoMedico($v) { @@ -931,14 +563,8 @@ $this->modifiedColumns[] = AlumnoPeer::CERTIFICADO_MEDICO; } - } // setCertificadoMedico() - - /** - * Set the value of [activo] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActivo($v) { @@ -947,14 +573,8 @@ $this->modifiedColumns[] = AlumnoPeer::ACTIVO; } - } // setActivo() - - /** - * Set the value of [fk_conceptobaja_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkConceptobajaId($v) { @@ -967,14 +587,8 @@ $this->aConceptobaja = null; } - } // setFkConceptobajaId() - - /** - * Set the value of [fk_pais_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPaisId($v) { @@ -987,21 +601,8 @@ $this->aPais = null; } - } // setFkPaisId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -1056,23 +657,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 23; // 23 = AlumnoPeer::NUM_COLUMNS - AlumnoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 23; } catch (Exception $e) { throw new PropelException("Error populating Alumno object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -1094,16 +685,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -1125,29 +707,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipodocumento !== null) { if ($this->aTipodocumento->isModified()) { $affectedRows += $this->aTipodocumento->save($con); @@ -1191,22 +758,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = AlumnoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += AlumnoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelCalendariovacunacionAlumnos !== null) { foreach($this->collRelCalendariovacunacionAlumnos as $referrerFK) { @@ -1267,37 +828,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -1310,16 +851,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -1329,11 +861,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipodocumento !== null) { if (!$this->aTipodocumento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aTipodocumento->getValidationFailures()); @@ -1439,28 +967,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = AlumnoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -1536,19 +1050,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = AlumnoPeer::getFieldNames($keyType); @@ -1580,30 +1084,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = AlumnoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -1676,25 +1164,9 @@ case 22: $this->setFkPaisId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AlumnoPeer::getFieldNames($keyType); @@ -1724,11 +1196,7 @@ if (array_key_exists($keys[22], $arr)) $this->setFkPaisId($arr[$keys[22]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(AlumnoPeer::DATABASE_NAME); @@ -1760,14 +1228,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(AlumnoPeer::DATABASE_NAME); @@ -1777,36 +1238,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Alumno (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1856,9 +1300,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelCalendariovacunacionAlumnos() as $relObj) { $copyObj->addRelCalendariovacunacionAlumno($relObj->copy($deepCopy)); @@ -1888,45 +1330,23 @@ $copyObj->addRelAlumnoDivision($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Alumno Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return AlumnoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1935,13 +1355,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Tipodocumento object. - * - * @param Tipodocumento $v - * @return void - * @throws PropelException - */ + public function setTipodocumento($v) { @@ -1957,42 +1371,21 @@ } - /** - * Get the associated Tipodocumento object - * - * @param Connection Optional Connection object. - * @return Tipodocumento The associated Tipodocumento object. - * @throws PropelException - */ + public function getTipodocumento($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipodocumentoPeer.php'; + include_once 'lib/model/om/BaseTipodocumentoPeer.php'; if ($this->aTipodocumento === null && ($this->fk_tipodocumento_id !== null)) { $this->aTipodocumento = TipodocumentoPeer::retrieveByPK($this->fk_tipodocumento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipodocumentoPeer::retrieveByPK($this->fk_tipodocumento_id, $con); - $obj->addTipodocumentos($this); - */ + } return $this->aTipodocumento; } - /** - * Declares an association between this object and a Cuenta object. - * - * @param Cuenta $v - * @return void - * @throws PropelException - */ + public function setCuenta($v) { @@ -2008,42 +1401,21 @@ } - /** - * Get the associated Cuenta object - * - * @param Connection Optional Connection object. - * @return Cuenta The associated Cuenta object. - * @throws PropelException - */ + public function getCuenta($con = null) { - // include the related Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($this->aCuenta === null && ($this->fk_cuenta_id !== null)) { $this->aCuenta = CuentaPeer::retrieveByPK($this->fk_cuenta_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CuentaPeer::retrieveByPK($this->fk_cuenta_id, $con); - $obj->addCuentas($this); - */ + } return $this->aCuenta; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -2059,42 +1431,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Declares an association between this object and a Provincia object. - * - * @param Provincia $v - * @return void - * @throws PropelException - */ + public function setProvincia($v) { @@ -2110,42 +1461,21 @@ } - /** - * Get the associated Provincia object - * - * @param Connection Optional Connection object. - * @return Provincia The associated Provincia object. - * @throws PropelException - */ + public function getProvincia($con = null) { - // include the related Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($this->aProvincia === null && ($this->fk_provincia_id !== null)) { $this->aProvincia = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - $obj->addProvincias($this); - */ + } return $this->aProvincia; } - /** - * Declares an association between this object and a Conceptobaja object. - * - * @param Conceptobaja $v - * @return void - * @throws PropelException - */ + public function setConceptobaja($v) { @@ -2161,42 +1491,21 @@ } - /** - * Get the associated Conceptobaja object - * - * @param Connection Optional Connection object. - * @return Conceptobaja The associated Conceptobaja object. - * @throws PropelException - */ + public function getConceptobaja($con = null) { - // include the related Peer class - include_once 'model/om/BaseConceptobajaPeer.php'; + include_once 'lib/model/om/BaseConceptobajaPeer.php'; if ($this->aConceptobaja === null && ($this->fk_conceptobaja_id !== null)) { $this->aConceptobaja = ConceptobajaPeer::retrieveByPK($this->fk_conceptobaja_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ConceptobajaPeer::retrieveByPK($this->fk_conceptobaja_id, $con); - $obj->addConceptobajas($this); - */ + } return $this->aConceptobaja; } - /** - * Declares an association between this object and a Pais object. - * - * @param Pais $v - * @return void - * @throws PropelException - */ + public function setPais($v) { @@ -2212,41 +1521,21 @@ } - /** - * Get the associated Pais object - * - * @param Connection Optional Connection object. - * @return Pais The associated Pais object. - * @throws PropelException - */ + public function getPais($con = null) { - // include the related Peer class - include_once 'model/om/BasePaisPeer.php'; + include_once 'lib/model/om/BasePaisPeer.php'; if ($this->aPais === null && ($this->fk_pais_id !== null)) { $this->aPais = PaisPeer::retrieveByPK($this->fk_pais_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PaisPeer::retrieveByPK($this->fk_pais_id, $con); - $obj->addPaiss($this); - */ + } return $this->aPais; } - /** - * Temporary storage of collRelCalendariovacunacionAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelCalendariovacunacionAlumnos() { if ($this->collRelCalendariovacunacionAlumnos === null) { @@ -2254,23 +1543,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related RelCalendariovacunacionAlumnos from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelCalendariovacunacionAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + include_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2290,13 +1566,9 @@ $this->collRelCalendariovacunacionAlumnos = RelCalendariovacunacionAlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelCalendariovacunacionAlumnoPeer::FK_ALUMNO_ID, $this->getId()); RelCalendariovacunacionAlumnoPeer::addSelectColumns($criteria); @@ -2309,18 +1581,10 @@ return $this->collRelCalendariovacunacionAlumnos; } - /** - * Returns the number of related RelCalendariovacunacionAlumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelCalendariovacunacionAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + include_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2334,14 +1598,7 @@ return RelCalendariovacunacionAlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelCalendariovacunacionAlumno object to this object - * through the RelCalendariovacunacionAlumno foreign key attribute - * - * @param RelCalendariovacunacionAlumno $l RelCalendariovacunacionAlumno - * @return void - * @throws PropelException - */ + public function addRelCalendariovacunacionAlumno(RelCalendariovacunacionAlumno $l) { $this->collRelCalendariovacunacionAlumnos[] = $l; @@ -2349,21 +1606,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related RelCalendariovacunacionAlumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getRelCalendariovacunacionAlumnosJoinCalendariovacunacion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + include_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2382,10 +1628,7 @@ $this->collRelCalendariovacunacionAlumnos = RelCalendariovacunacionAlumnoPeer::doSelectJoinCalendariovacunacion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelCalendariovacunacionAlumnoPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastRelCalendariovacunacionAlumnoCriteria) || !$this->lastRelCalendariovacunacionAlumnoCriteria->equals($criteria)) { @@ -2397,12 +1640,7 @@ return $this->collRelCalendariovacunacionAlumnos; } - /** - * Temporary storage of collLegajopedagogicos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLegajopedagogicos() { if ($this->collLegajopedagogicos === null) { @@ -2410,23 +1648,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLegajopedagogicos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2446,13 +1671,9 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LegajopedagogicoPeer::FK_ALUMNO_ID, $this->getId()); LegajopedagogicoPeer::addSelectColumns($criteria); @@ -2465,18 +1686,10 @@ return $this->collLegajopedagogicos; } - /** - * Returns the number of related Legajopedagogicos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLegajopedagogicos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2490,14 +1703,7 @@ return LegajopedagogicoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Legajopedagogico object to this object - * through the Legajopedagogico foreign key attribute - * - * @param Legajopedagogico $l Legajopedagogico - * @return void - * @throws PropelException - */ + public function addLegajopedagogico(Legajopedagogico $l) { $this->collLegajopedagogicos[] = $l; @@ -2505,21 +1711,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getLegajopedagogicosJoinLegajocategoria($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2538,10 +1733,7 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelectJoinLegajocategoria($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajopedagogicoPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastLegajopedagogicoCriteria) || !$this->lastLegajopedagogicoCriteria->equals($criteria)) { @@ -2554,21 +1746,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getLegajopedagogicosJoinUsuario($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2587,10 +1768,7 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelectJoinUsuario($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajopedagogicoPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastLegajopedagogicoCriteria) || !$this->lastLegajopedagogicoCriteria->equals($criteria)) { @@ -2602,12 +1780,7 @@ return $this->collLegajopedagogicos; } - /** - * Temporary storage of collAsistencias to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAsistencias() { if ($this->collAsistencias === null) { @@ -2615,23 +1788,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related Asistencias from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAsistencias($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAsistenciaPeer.php'; + include_once 'lib/model/om/BaseAsistenciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2651,13 +1811,9 @@ $this->collAsistencias = AsistenciaPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AsistenciaPeer::FK_ALUMNO_ID, $this->getId()); AsistenciaPeer::addSelectColumns($criteria); @@ -2670,18 +1826,10 @@ return $this->collAsistencias; } - /** - * Returns the number of related Asistencias. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAsistencias($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAsistenciaPeer.php'; + include_once 'lib/model/om/BaseAsistenciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2695,14 +1843,7 @@ return AsistenciaPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Asistencia object to this object - * through the Asistencia foreign key attribute - * - * @param Asistencia $l Asistencia - * @return void - * @throws PropelException - */ + public function addAsistencia(Asistencia $l) { $this->collAsistencias[] = $l; @@ -2710,21 +1851,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related Asistencias from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getAsistenciasJoinTipoasistencia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAsistenciaPeer.php'; + include_once 'lib/model/om/BaseAsistenciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2743,10 +1873,7 @@ $this->collAsistencias = AsistenciaPeer::doSelectJoinTipoasistencia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AsistenciaPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastAsistenciaCriteria) || !$this->lastAsistenciaCriteria->equals($criteria)) { @@ -2758,12 +1885,7 @@ return $this->collAsistencias; } - /** - * Temporary storage of collBoletinConceptuals to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinConceptuals() { if ($this->collBoletinConceptuals === null) { @@ -2771,23 +1893,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinConceptuals($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2807,13 +1916,9 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinConceptualPeer::FK_ALUMNO_ID, $this->getId()); BoletinConceptualPeer::addSelectColumns($criteria); @@ -2826,18 +1931,10 @@ return $this->collBoletinConceptuals; } - /** - * Returns the number of related BoletinConceptuals. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinConceptuals($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2851,14 +1948,7 @@ return BoletinConceptualPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinConceptual object to this object - * through the BoletinConceptual foreign key attribute - * - * @param BoletinConceptual $l BoletinConceptual - * @return void - * @throws PropelException - */ + public function addBoletinConceptual(BoletinConceptual $l) { $this->collBoletinConceptuals[] = $l; @@ -2866,21 +1956,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getBoletinConceptualsJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2899,10 +1978,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -2915,21 +1991,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getBoletinConceptualsJoinConcepto($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2948,10 +2013,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinConcepto($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -2964,21 +2026,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getBoletinConceptualsJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2997,10 +2048,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -3012,12 +2060,7 @@ return $this->collBoletinConceptuals; } - /** - * Temporary storage of collBoletinActividadess to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinActividadess() { if ($this->collBoletinActividadess === null) { @@ -3025,23 +2068,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinActividadess($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3061,13 +2091,9 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId()); BoletinActividadesPeer::addSelectColumns($criteria); @@ -3080,18 +2106,10 @@ return $this->collBoletinActividadess; } - /** - * Returns the number of related BoletinActividadess. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinActividadess($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3105,14 +2123,7 @@ return BoletinActividadesPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinActividades object to this object - * through the BoletinActividades foreign key attribute - * - * @param BoletinActividades $l BoletinActividades - * @return void - * @throws PropelException - */ + public function addBoletinActividades(BoletinActividades $l) { $this->collBoletinActividadess[] = $l; @@ -3120,21 +2131,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getBoletinActividadessJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3153,10 +2153,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -3169,21 +2166,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getBoletinActividadessJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3202,10 +2188,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -3218,21 +2201,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getBoletinActividadessJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3251,10 +2223,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -3266,12 +2235,7 @@ return $this->collBoletinActividadess; } - /** - * Temporary storage of collExamens to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initExamens() { if ($this->collExamens === null) { @@ -3279,23 +2243,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related Examens from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getExamens($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3315,13 +2266,9 @@ $this->collExamens = ExamenPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ExamenPeer::FK_ALUMNO_ID, $this->getId()); ExamenPeer::addSelectColumns($criteria); @@ -3334,18 +2281,10 @@ return $this->collExamens; } - /** - * Returns the number of related Examens. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countExamens($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3359,14 +2298,7 @@ return ExamenPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Examen object to this object - * through the Examen foreign key attribute - * - * @param Examen $l Examen - * @return void - * @throws PropelException - */ + public function addExamen(Examen $l) { $this->collExamens[] = $l; @@ -3374,21 +2306,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getExamensJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3407,10 +2328,7 @@ $this->collExamens = ExamenPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -3423,21 +2341,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getExamensJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3456,10 +2363,7 @@ $this->collExamens = ExamenPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -3472,21 +2376,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getExamensJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3505,10 +2398,7 @@ $this->collExamens = ExamenPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -3520,12 +2410,7 @@ return $this->collExamens; } - /** - * Temporary storage of collRelAlumnoDivisions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelAlumnoDivisions() { if ($this->collRelAlumnoDivisions === null) { @@ -3533,23 +2418,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno has previously - * been saved, it will retrieve related RelAlumnoDivisions from storage. - * If this Alumno is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelAlumnoDivisions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + include_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3569,13 +2441,9 @@ $this->collRelAlumnoDivisions = RelAlumnoDivisionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $this->getId()); RelAlumnoDivisionPeer::addSelectColumns($criteria); @@ -3588,18 +2456,10 @@ return $this->collRelAlumnoDivisions; } - /** - * Returns the number of related RelAlumnoDivisions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelAlumnoDivisions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + include_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3613,14 +2473,7 @@ return RelAlumnoDivisionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelAlumnoDivision object to this object - * through the RelAlumnoDivision foreign key attribute - * - * @param RelAlumnoDivision $l RelAlumnoDivision - * @return void - * @throws PropelException - */ + public function addRelAlumnoDivision(RelAlumnoDivision $l) { $this->collRelAlumnoDivisions[] = $l; @@ -3628,21 +2481,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Alumno is new, it will return - * an empty collection; or if this Alumno has previously - * been saved, it will retrieve related RelAlumnoDivisions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Alumno. - */ + public function getRelAlumnoDivisionsJoinDivision($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + include_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -3661,10 +2503,7 @@ $this->collRelAlumnoDivisions = RelAlumnoDivisionPeer::doSelectJoinDivision($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $this->getId()); if (!isset($this->lastRelAlumnoDivisionCriteria) || !$this->lastRelAlumnoDivisionCriteria->equals($criteria)) { @@ -3676,4 +2515,4 @@ return $this->collRelAlumnoDivisions; } -} // BaseAlumno +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAlumnoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAlumnoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAlumnoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,114 +1,98 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by AlumnoPeer::getOMClass() -include_once 'model/Alumno.php'; -/** - * Base static class for performing query and update operations on the 'alumno' table. - * - * - * - * @package model.om - */ abstract class BaseAlumnoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'alumno'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Alumno'; + + const CLASS_DEFAULT = 'lib.model.Alumno'; - /** The total number of columns. */ + const NUM_COLUMNS = 23; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'alumno.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'alumno.NOMBRE'; - /** the column name for the APELLIDO field */ + const APELLIDO = 'alumno.APELLIDO'; - /** the column name for the FECHA_NACIMIENTO field */ + const FECHA_NACIMIENTO = 'alumno.FECHA_NACIMIENTO'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'alumno.DIRECCION'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'alumno.CIUDAD'; - /** the column name for the CODIGO_POSTAL field */ + const CODIGO_POSTAL = 'alumno.CODIGO_POSTAL'; - /** the column name for the FK_PROVINCIA_ID field */ + const FK_PROVINCIA_ID = 'alumno.FK_PROVINCIA_ID'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'alumno.TELEFONO'; - /** the column name for the LUGAR_NACIMIENTO field */ + const LUGAR_NACIMIENTO = 'alumno.LUGAR_NACIMIENTO'; - /** the column name for the FK_TIPODOCUMENTO_ID field */ + const FK_TIPODOCUMENTO_ID = 'alumno.FK_TIPODOCUMENTO_ID'; - /** the column name for the NRO_DOCUMENTO field */ + const NRO_DOCUMENTO = 'alumno.NRO_DOCUMENTO'; - /** the column name for the SEXO field */ + const SEXO = 'alumno.SEXO'; - /** the column name for the EMAIL field */ + const EMAIL = 'alumno.EMAIL'; - /** the column name for the DISTANCIA_ESCUELA field */ + const DISTANCIA_ESCUELA = 'alumno.DISTANCIA_ESCUELA'; - /** the column name for the HERMANOS_ESCUELA field */ + const HERMANOS_ESCUELA = 'alumno.HERMANOS_ESCUELA'; - /** the column name for the HIJO_MAESTRO_ESCUELA field */ + const HIJO_MAESTRO_ESCUELA = 'alumno.HIJO_MAESTRO_ESCUELA'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'alumno.FK_ESTABLECIMIENTO_ID'; - /** the column name for the FK_CUENTA_ID field */ + const FK_CUENTA_ID = 'alumno.FK_CUENTA_ID'; - /** the column name for the CERTIFICADO_MEDICO field */ + const CERTIFICADO_MEDICO = 'alumno.CERTIFICADO_MEDICO'; - /** the column name for the ACTIVO field */ + const ACTIVO = 'alumno.ACTIVO'; - /** the column name for the FK_CONCEPTOBAJA_ID field */ + const FK_CONCEPTOBAJA_ID = 'alumno.FK_CONCEPTOBAJA_ID'; - /** the column name for the FK_PAIS_ID field */ + const FK_PAIS_ID = 'alumno.FK_PAIS_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Apellido', 'FechaNacimiento', 'Direccion', 'Ciudad', 'CodigoPostal', 'FkProvinciaId', 'Telefono', 'LugarNacimiento', 'FkTipodocumentoId', 'NroDocumento', 'Sexo', 'Email', 'DistanciaEscuela', 'HermanosEscuela', 'HijoMaestroEscuela', 'FkEstablecimientoId', 'FkCuentaId', 'CertificadoMedico', 'Activo', 'FkConceptobajaId', 'FkPaisId', ), BasePeer::TYPE_COLNAME => array (AlumnoPeer::ID, AlumnoPeer::NOMBRE, AlumnoPeer::APELLIDO, AlumnoPeer::FECHA_NACIMIENTO, AlumnoPeer::DIRECCION, AlumnoPeer::CIUDAD, AlumnoPeer::CODIGO_POSTAL, AlumnoPeer::FK_PROVINCIA_ID, AlumnoPeer::TELEFONO, AlumnoPeer::LUGAR_NACIMIENTO, AlumnoPeer::FK_TIPODOCUMENTO_ID, AlumnoPeer::NRO_DOCUMENTO, AlumnoPeer::SEXO, AlumnoPeer::EMAIL, AlumnoPeer::DISTANCIA_ESCUELA, AlumnoPeer::HERMANOS_ESCUELA, AlumnoPeer::HIJO_MAESTRO_ESCUELA, AlumnoPeer::FK_ESTABLECIMIENTO_ID, AlumnoPeer::FK_CUENTA_ID, AlumnoPeer::CERTIFICADO_MEDICO, AlumnoPeer::ACTIVO, AlumnoPeer::FK_CONCEPTOBAJA_ID, AlumnoPeer::FK_PAIS_ID, ), @@ -116,12 +100,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Apellido' => 2, 'FechaNacimiento' => 3, 'Direccion' => 4, 'Ciudad' => 5, 'CodigoPostal' => 6, 'FkProvinciaId' => 7, 'Telefono' => 8, 'LugarNacimiento' => 9, 'FkTipodocumentoId' => 10, 'NroDocumento' => 11, 'Sexo' => 12, 'Email' => 13, 'DistanciaEscuela' => 14, 'HermanosEscuela' => 15, 'HijoMaestroEscuela' => 16, 'FkEstablecimientoId' => 17, 'FkCuentaId' => 18, 'CertificadoMedico' => 19, 'Activo' => 20, 'FkConceptobajaId' => 21, 'FkPaisId' => 22, ), BasePeer::TYPE_COLNAME => array (AlumnoPeer::ID => 0, AlumnoPeer::NOMBRE => 1, AlumnoPeer::APELLIDO => 2, AlumnoPeer::FECHA_NACIMIENTO => 3, AlumnoPeer::DIRECCION => 4, AlumnoPeer::CIUDAD => 5, AlumnoPeer::CODIGO_POSTAL => 6, AlumnoPeer::FK_PROVINCIA_ID => 7, AlumnoPeer::TELEFONO => 8, AlumnoPeer::LUGAR_NACIMIENTO => 9, AlumnoPeer::FK_TIPODOCUMENTO_ID => 10, AlumnoPeer::NRO_DOCUMENTO => 11, AlumnoPeer::SEXO => 12, AlumnoPeer::EMAIL => 13, AlumnoPeer::DISTANCIA_ESCUELA => 14, AlumnoPeer::HERMANOS_ESCUELA => 15, AlumnoPeer::HIJO_MAESTRO_ESCUELA => 16, AlumnoPeer::FK_ESTABLECIMIENTO_ID => 17, AlumnoPeer::FK_CUENTA_ID => 18, AlumnoPeer::CERTIFICADO_MEDICO => 19, AlumnoPeer::ACTIVO => 20, AlumnoPeer::FK_CONCEPTOBAJA_ID => 21, AlumnoPeer::FK_PAIS_ID => 22, ), @@ -129,24 +108,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/AlumnoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.AlumnoMapBuilder'); + include_once 'lib/model/map/AlumnoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.AlumnoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -160,15 +128,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -179,14 +139,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -196,34 +149,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. AlumnoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(AlumnoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -278,29 +210,19 @@ const COUNT = 'COUNT(alumno.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT alumno.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -309,19 +231,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Alumno - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -332,33 +245,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return AlumnoPeer::populateObjects(AlumnoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -370,29 +262,18 @@ AlumnoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = AlumnoPeer::getOMClass(); + $cls = AlumnoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -402,29 +283,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Tipodocumento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipodocumento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -435,35 +306,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Cuenta table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCuenta(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -474,35 +334,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -513,35 +362,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -552,35 +390,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Conceptobaja table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinConceptobaja(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -591,35 +418,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Pais table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPais(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -630,25 +446,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Alumno objects pre-filled with their Tipodocumento objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipodocumento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -676,37 +484,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAlumno($obj1); //CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } if ($newObject) { $obj2->initAlumnos(); - $obj2->addAlumno($obj1); //CHECKME - } + $obj2->addAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Alumno objects pre-filled with their Cuenta objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCuenta(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -734,37 +531,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCuenta(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAlumno($obj1); //CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } if ($newObject) { $obj2->initAlumnos(); - $obj2->addAlumno($obj1); //CHECKME - } + $obj2->addAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Alumno objects pre-filled with their Establecimiento objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -792,37 +578,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAlumno($obj1); //CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } if ($newObject) { $obj2->initAlumnos(); - $obj2->addAlumno($obj1); //CHECKME - } + $obj2->addAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Alumno objects pre-filled with their Provincia objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -850,37 +625,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAlumno($obj1); //CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } if ($newObject) { $obj2->initAlumnos(); - $obj2->addAlumno($obj1); //CHECKME - } + $obj2->addAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Alumno objects pre-filled with their Conceptobaja objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinConceptobaja(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -908,37 +672,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getConceptobaja(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getConceptobaja(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAlumno($obj1); //CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } if ($newObject) { $obj2->initAlumnos(); - $obj2->addAlumno($obj1); //CHECKME - } + $obj2->addAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Alumno objects pre-filled with their Pais objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPais(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -966,46 +719,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPais(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAlumno($obj1); //CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } if ($newObject) { $obj2->initAlumnos(); - $obj2->addAlumno($obj1); //CHECKME - } + $obj2->addAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1026,25 +766,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Alumno objects pre-filled with all related objects. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1094,8 +826,7 @@ $obj1->hydrate($rs); - // Add objects for joined Tipodocumento rows - + $omClass = TipodocumentoPeer::getOMClass(); @@ -1106,11 +837,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addAlumno($obj1); // CHECKME - break; + $temp_obj2->addAlumno($obj1); break; } } @@ -1120,8 +849,7 @@ } - // Add objects for joined Cuenta rows - + $omClass = CuentaPeer::getOMClass(); @@ -1132,11 +860,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCuenta(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCuenta(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addAlumno($obj1); // CHECKME - break; + $temp_obj3->addAlumno($obj1); break; } } @@ -1146,8 +872,7 @@ } - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -1158,11 +883,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getEstablecimiento(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addAlumno($obj1); // CHECKME - break; + $temp_obj4->addAlumno($obj1); break; } } @@ -1172,8 +895,7 @@ } - // Add objects for joined Provincia rows - + $omClass = ProvinciaPeer::getOMClass(); @@ -1184,11 +906,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getProvincia(); // CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getProvincia(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; - $temp_obj5->addAlumno($obj1); // CHECKME - break; + $temp_obj5->addAlumno($obj1); break; } } @@ -1198,8 +918,7 @@ } - // Add objects for joined Conceptobaja rows - + $omClass = ConceptobajaPeer::getOMClass(); @@ -1210,11 +929,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getConceptobaja(); // CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getConceptobaja(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; - $temp_obj6->addAlumno($obj1); // CHECKME - break; + $temp_obj6->addAlumno($obj1); break; } } @@ -1224,8 +941,7 @@ } - // Add objects for joined Pais rows - + $omClass = PaisPeer::getOMClass(); @@ -1236,11 +952,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj7 = $temp_obj1->getPais(); // CHECKME - if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { + $temp_obj7 = $temp_obj1->getPais(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; - $temp_obj7->addAlumno($obj1); // CHECKME - break; + $temp_obj7->addAlumno($obj1); break; } } @@ -1255,29 +969,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Tipodocumento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipodocumento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1296,35 +1000,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Cuenta table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptCuenta(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1343,35 +1036,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1390,35 +1072,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1437,35 +1108,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Conceptobaja table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptConceptobaja(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1484,35 +1144,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Pais table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptPais(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1531,27 +1180,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Alumno objects pre-filled with all related objects except Tipodocumento. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipodocumento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1605,8 +1244,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCuenta(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAlumno($obj1); break; @@ -1628,8 +1266,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getEstablecimiento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addAlumno($obj1); break; @@ -1651,8 +1288,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getProvincia(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addAlumno($obj1); break; @@ -1674,8 +1310,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getConceptobaja(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getConceptobaja(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addAlumno($obj1); break; @@ -1697,8 +1332,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getPais(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addAlumno($obj1); break; @@ -1716,21 +1350,12 @@ } - /** - * Selects a collection of Alumno objects pre-filled with all related objects except Cuenta. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptCuenta(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1784,8 +1409,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAlumno($obj1); break; @@ -1807,8 +1431,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getEstablecimiento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addAlumno($obj1); break; @@ -1830,8 +1453,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getProvincia(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addAlumno($obj1); break; @@ -1853,8 +1475,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getConceptobaja(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getConceptobaja(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addAlumno($obj1); break; @@ -1876,8 +1497,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getPais(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addAlumno($obj1); break; @@ -1895,21 +1515,12 @@ } - /** - * Selects a collection of Alumno objects pre-filled with all related objects except Establecimiento. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1963,8 +1574,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAlumno($obj1); break; @@ -1986,8 +1596,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCuenta(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addAlumno($obj1); break; @@ -2009,8 +1618,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getProvincia(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addAlumno($obj1); break; @@ -2032,8 +1640,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getConceptobaja(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getConceptobaja(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addAlumno($obj1); break; @@ -2055,8 +1662,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getPais(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addAlumno($obj1); break; @@ -2074,21 +1680,12 @@ } - /** - * Selects a collection of Alumno objects pre-filled with all related objects except Provincia. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -2142,8 +1739,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAlumno($obj1); break; @@ -2165,8 +1761,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCuenta(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addAlumno($obj1); break; @@ -2188,8 +1783,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getEstablecimiento(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addAlumno($obj1); break; @@ -2211,8 +1805,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getConceptobaja(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getConceptobaja(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addAlumno($obj1); break; @@ -2234,8 +1827,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getPais(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addAlumno($obj1); break; @@ -2253,21 +1845,12 @@ } - /** - * Selects a collection of Alumno objects pre-filled with all related objects except Conceptobaja. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptConceptobaja(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -2321,8 +1904,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAlumno($obj1); break; @@ -2344,8 +1926,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCuenta(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addAlumno($obj1); break; @@ -2367,8 +1948,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getEstablecimiento(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addAlumno($obj1); break; @@ -2390,8 +1970,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getProvincia(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addAlumno($obj1); break; @@ -2413,8 +1992,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getPais(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addAlumno($obj1); break; @@ -2432,21 +2010,12 @@ } - /** - * Selects a collection of Alumno objects pre-filled with all related objects except Pais. - * - * @return array Array of Alumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptPais(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -2500,8 +2069,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAlumno($obj1); break; @@ -2523,8 +2091,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCuenta(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addAlumno($obj1); break; @@ -2546,8 +2113,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getEstablecimiento(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addAlumno($obj1); break; @@ -2569,8 +2135,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getProvincia(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addAlumno($obj1); break; @@ -2592,8 +2157,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getConceptobaja(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getConceptobaja(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addAlumno($obj1); break; @@ -2610,41 +2174,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return AlumnoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Alumno or Criteria object. - * - * @param mixed $values Criteria or Alumno object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -2652,21 +2194,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Alumno object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(AlumnoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(AlumnoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -2677,15 +2213,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Alumno or Criteria object. - * - * @param mixed $values Criteria or Alumno object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -2695,37 +2223,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(AlumnoPeer::ID); $selectCriteria->add(AlumnoPeer::ID, $criteria->remove(AlumnoPeer::ID), $comparison); - } else { // $values is Alumno object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the alumno table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(AlumnoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -2735,17 +2251,7 @@ } } - /** - * Method perform a DELETE on the database, given a Alumno or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Alumno object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -2753,25 +2259,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Alumno) { + $criteria = clone $values; } elseif ($values instanceof Alumno) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(AlumnoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -2782,18 +2282,7 @@ } } - /** - * Validates all modified columns of given Alumno object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Alumno $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Alumno $obj, $cols = null) { $columns = array(); @@ -2828,13 +2317,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Alumno - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -2851,14 +2334,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -2876,20 +2352,14 @@ return $objs; } -} // BaseAlumnoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseAlumnoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/AlumnoMapBuilder.php'; - Propel::registerMapBuilder('model.map.AlumnoMapBuilder'); + require_once 'lib/model/map/AlumnoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.AlumnoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAnio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAnio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAnio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,135 +1,67 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/AnioPeer.php'; - -/** - * Base class that represents a row from the 'anio' table. - * - * - * - * @package model.om - */ abstract class BaseAnio extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var AnioPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Collection to store aggregation of collDivisions. - * @var array - */ + protected $collDivisions; - /** - * The criteria used to select the current contents of collDivisions. - * @var Criteria - */ + protected $lastDivisionCriteria = null; - /** - * Collection to store aggregation of collRelAnioActividads. - * @var array - */ + protected $collRelAnioActividads; - /** - * The criteria used to select the current contents of collRelAnioActividads. - * @var Criteria - */ + protected $lastRelAnioActividadCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -138,14 +70,8 @@ $this->modifiedColumns[] = AnioPeer::ID; } - } // setId() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -158,14 +84,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -174,21 +94,8 @@ $this->modifiedColumns[] = AnioPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -203,23 +110,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = AnioPeer::NUM_COLUMNS - AnioPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Anio object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -241,16 +138,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -272,29 +160,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -303,22 +176,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = AnioPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += AnioPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collDivisions !== null) { foreach($this->collDivisions as $referrerFK) { @@ -339,37 +206,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -382,16 +229,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -401,11 +239,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -441,28 +275,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = AnioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -478,19 +298,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = AnioPeer::getFieldNames($keyType); @@ -502,30 +312,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = AnioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -538,25 +332,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AnioPeer::getFieldNames($keyType); @@ -566,11 +344,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(AnioPeer::DATABASE_NAME); @@ -582,14 +356,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(AnioPeer::DATABASE_NAME); @@ -599,36 +366,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Anio (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -638,9 +388,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getDivisions() as $relObj) { $copyObj->addDivision($relObj->copy($deepCopy)); @@ -650,45 +398,23 @@ $copyObj->addRelAnioActividad($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Anio Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return AnioPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -697,13 +423,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -719,41 +439,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Temporary storage of collDivisions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initDivisions() { if ($this->collDivisions === null) { @@ -761,23 +461,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Anio has previously - * been saved, it will retrieve related Divisions from storage. - * If this Anio is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getDivisions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -797,13 +484,9 @@ $this->collDivisions = DivisionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(DivisionPeer::FK_ANIO_ID, $this->getId()); DivisionPeer::addSelectColumns($criteria); @@ -816,18 +499,10 @@ return $this->collDivisions; } - /** - * Returns the number of related Divisions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countDivisions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -841,14 +516,7 @@ return DivisionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Division object to this object - * through the Division foreign key attribute - * - * @param Division $l Division - * @return void - * @throws PropelException - */ + public function addDivision(Division $l) { $this->collDivisions[] = $l; @@ -856,21 +524,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Anio is new, it will return - * an empty collection; or if this Anio has previously - * been saved, it will retrieve related Divisions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Anio. - */ + public function getDivisionsJoinTurnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -889,10 +546,7 @@ $this->collDivisions = DivisionPeer::doSelectJoinTurnos($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(DivisionPeer::FK_ANIO_ID, $this->getId()); if (!isset($this->lastDivisionCriteria) || !$this->lastDivisionCriteria->equals($criteria)) { @@ -904,12 +558,7 @@ return $this->collDivisions; } - /** - * Temporary storage of collRelAnioActividads to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelAnioActividads() { if ($this->collRelAnioActividads === null) { @@ -917,23 +566,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Anio has previously - * been saved, it will retrieve related RelAnioActividads from storage. - * If this Anio is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelAnioActividads($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAnioActividadPeer.php'; + include_once 'lib/model/om/BaseRelAnioActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -953,13 +589,9 @@ $this->collRelAnioActividads = RelAnioActividadPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelAnioActividadPeer::FK_ANIO_ID, $this->getId()); RelAnioActividadPeer::addSelectColumns($criteria); @@ -972,18 +604,10 @@ return $this->collRelAnioActividads; } - /** - * Returns the number of related RelAnioActividads. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelAnioActividads($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAnioActividadPeer.php'; + include_once 'lib/model/om/BaseRelAnioActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -997,14 +621,7 @@ return RelAnioActividadPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelAnioActividad object to this object - * through the RelAnioActividad foreign key attribute - * - * @param RelAnioActividad $l RelAnioActividad - * @return void - * @throws PropelException - */ + public function addRelAnioActividad(RelAnioActividad $l) { $this->collRelAnioActividads[] = $l; @@ -1012,21 +629,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Anio is new, it will return - * an empty collection; or if this Anio has previously - * been saved, it will retrieve related RelAnioActividads from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Anio. - */ + public function getRelAnioActividadsJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAnioActividadPeer.php'; + include_once 'lib/model/om/BaseRelAnioActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1045,10 +651,7 @@ $this->collRelAnioActividads = RelAnioActividadPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelAnioActividadPeer::FK_ANIO_ID, $this->getId()); if (!isset($this->lastRelAnioActividadCriteria) || !$this->lastRelAnioActividadCriteria->equals($criteria)) { @@ -1060,4 +663,4 @@ return $this->collRelAnioActividads; } -} // BaseAnio +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAnioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAnioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAnioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by AnioPeer::getOMClass() -include_once 'model/Anio.php'; -/** - * Base static class for performing query and update operations on the 'anio' table. - * - * - * - * @package model.om - */ abstract class BaseAnioPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'anio'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Anio'; + + const CLASS_DEFAULT = 'lib.model.Anio'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'anio.ID'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'anio.FK_ESTABLECIMIENTO_ID'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'anio.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEstablecimientoId', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (AnioPeer::ID, AnioPeer::FK_ESTABLECIMIENTO_ID, AnioPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEstablecimientoId' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (AnioPeer::ID => 0, AnioPeer::FK_ESTABLECIMIENTO_ID => 1, AnioPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/AnioMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.AnioMapBuilder'); + include_once 'lib/model/map/AnioMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.AnioMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. AnioPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(AnioPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(anio.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT anio.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AnioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AnioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Anio - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return AnioPeer::populateObjects(AnioPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ AnioPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = AnioPeer::getOMClass(); + $cls = AnioPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -302,29 +183,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AnioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AnioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -335,25 +206,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Anio objects pre-filled with their Establecimiento objects. - * - * @return array Array of Anio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -381,46 +244,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAnio($obj1); //CHECKME - break; + $temp_obj2->addAnio($obj1); break; } } if ($newObject) { $obj2->initAnios(); - $obj2->addAnio($obj1); //CHECKME - } + $obj2->addAnio($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AnioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AnioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -431,25 +281,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Anio objects pre-filled with all related objects. - * - * @return array Array of Anio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -474,8 +316,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -486,11 +327,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addAnio($obj1); // CHECKME - break; + $temp_obj2->addAnio($obj1); break; } } @@ -504,41 +343,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return AnioPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Anio or Criteria object. - * - * @param mixed $values Criteria or Anio object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -546,21 +363,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Anio object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(AnioPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(AnioPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -571,15 +382,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Anio or Criteria object. - * - * @param mixed $values Criteria or Anio object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -589,37 +392,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(AnioPeer::ID); $selectCriteria->add(AnioPeer::ID, $criteria->remove(AnioPeer::ID), $comparison); - } else { // $values is Anio object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the anio table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(AnioPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -629,17 +420,7 @@ } } - /** - * Method perform a DELETE on the database, given a Anio or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Anio object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -647,25 +428,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Anio) { + $criteria = clone $values; } elseif ($values instanceof Anio) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(AnioPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -676,18 +451,7 @@ } } - /** - * Validates all modified columns of given Anio object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Anio $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Anio $obj, $cols = null) { $columns = array(); @@ -722,13 +486,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Anio - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -745,14 +503,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -770,20 +521,14 @@ return $objs; } -} // BaseAnioPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseAnioPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/AnioMapBuilder.php'; - Propel::registerMapBuilder('model.map.AnioMapBuilder'); + require_once 'lib/model/map/AnioMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.AnioMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAsistencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAsistencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAsistencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,135 +1,70 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/AsistenciaPeer.php'; - -/** - * Base class that represents a row from the 'asistencia' table. - * - * - * - * @package model.om - */ abstract class BaseAsistencia extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var AsistenciaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id; - /** - * The value for the fk_tipoasistencia_id field. - * @var int - */ + protected $fk_tipoasistencia_id; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * @var Tipoasistencia - */ + protected $aTipoasistencia; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Get the [fk_tipoasistencia_id] column value. - * - * @return int - */ + public function getFkTipoasistenciaId() { return $this->fk_tipoasistencia_id; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -143,12 +78,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -157,14 +87,8 @@ $this->modifiedColumns[] = AsistenciaPeer::ID; } - } // setId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -177,14 +101,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Set the value of [fk_tipoasistencia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipoasistenciaId($v) { @@ -197,21 +115,14 @@ $this->aTipoasistencia = null; } - } // setFkTipoasistenciaId() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -221,21 +132,8 @@ $this->modifiedColumns[] = AsistenciaPeer::FECHA; } - } // setFecha() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -252,23 +150,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = AsistenciaPeer::NUM_COLUMNS - AsistenciaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Asistencia object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -290,16 +178,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -321,29 +200,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAlumno !== null) { if ($this->aAlumno->isModified()) { $affectedRows += $this->aAlumno->save($con); @@ -359,57 +223,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = AsistenciaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += AsistenciaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -422,16 +260,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -441,11 +270,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAlumno !== null) { if (!$this->aAlumno->validate($columns)) { $failureMap = array_merge($failureMap, $this->aAlumno->getValidationFailures()); @@ -471,28 +296,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = AsistenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -511,19 +322,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = AsistenciaPeer::getFieldNames($keyType); @@ -536,30 +337,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = AsistenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -575,25 +360,9 @@ case 3: $this->setFecha($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AsistenciaPeer::getFieldNames($keyType); @@ -604,11 +373,7 @@ if (array_key_exists($keys[3], $arr)) $this->setFecha($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(AsistenciaPeer::DATABASE_NAME); @@ -621,14 +386,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(AsistenciaPeer::DATABASE_NAME); @@ -638,36 +396,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Asistencia (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -680,40 +421,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Asistencia Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return AsistenciaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -722,13 +442,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -744,42 +458,21 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } - /** - * Declares an association between this object and a Tipoasistencia object. - * - * @param Tipoasistencia $v - * @return void - * @throws PropelException - */ + public function setTipoasistencia($v) { @@ -795,33 +488,18 @@ } - /** - * Get the associated Tipoasistencia object - * - * @param Connection Optional Connection object. - * @return Tipoasistencia The associated Tipoasistencia object. - * @throws PropelException - */ + public function getTipoasistencia($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipoasistenciaPeer.php'; + include_once 'lib/model/om/BaseTipoasistenciaPeer.php'; if ($this->aTipoasistencia === null && ($this->fk_tipoasistencia_id !== null)) { $this->aTipoasistencia = TipoasistenciaPeer::retrieveByPK($this->fk_tipoasistencia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipoasistenciaPeer::retrieveByPK($this->fk_tipoasistencia_id, $con); - $obj->addTipoasistencias($this); - */ + } return $this->aTipoasistencia; } -} // BaseAsistencia +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseAsistenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseAsistenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseAsistenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by AsistenciaPeer::getOMClass() -include_once 'model/Asistencia.php'; -/** - * Base static class for performing query and update operations on the 'asistencia' table. - * - * - * - * @package model.om - */ abstract class BaseAsistenciaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'asistencia'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Asistencia'; + + const CLASS_DEFAULT = 'lib.model.Asistencia'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'asistencia.ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'asistencia.FK_ALUMNO_ID'; - /** the column name for the FK_TIPOASISTENCIA_ID field */ + const FK_TIPOASISTENCIA_ID = 'asistencia.FK_TIPOASISTENCIA_ID'; - /** the column name for the FECHA field */ + const FECHA = 'asistencia.FECHA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkAlumnoId', 'FkTipoasistenciaId', 'Fecha', ), BasePeer::TYPE_COLNAME => array (AsistenciaPeer::ID, AsistenciaPeer::FK_ALUMNO_ID, AsistenciaPeer::FK_TIPOASISTENCIA_ID, AsistenciaPeer::FECHA, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkAlumnoId' => 1, 'FkTipoasistenciaId' => 2, 'Fecha' => 3, ), BasePeer::TYPE_COLNAME => array (AsistenciaPeer::ID => 0, AsistenciaPeer::FK_ALUMNO_ID => 1, AsistenciaPeer::FK_TIPOASISTENCIA_ID => 2, AsistenciaPeer::FECHA => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/AsistenciaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.AsistenciaMapBuilder'); + include_once 'lib/model/map/AsistenciaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.AsistenciaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. AsistenciaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(AsistenciaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(asistencia.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT asistencia.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AsistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AsistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Asistencia - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return AsistenciaPeer::populateObjects(AsistenciaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ AsistenciaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = AsistenciaPeer::getOMClass(); + $cls = AsistenciaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -307,29 +188,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AsistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AsistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -340,35 +211,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipoasistencia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipoasistencia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AsistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AsistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -379,25 +239,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Asistencia objects pre-filled with their Alumno objects. - * - * @return array Array of Asistencia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -425,37 +277,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAsistencia($obj1); //CHECKME - break; + $temp_obj2->addAsistencia($obj1); break; } } if ($newObject) { $obj2->initAsistencias(); - $obj2->addAsistencia($obj1); //CHECKME - } + $obj2->addAsistencia($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Asistencia objects pre-filled with their Tipoasistencia objects. - * - * @return array Array of Asistencia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipoasistencia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -483,46 +324,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipoasistencia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoasistencia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addAsistencia($obj1); //CHECKME - break; + $temp_obj2->addAsistencia($obj1); break; } } if ($newObject) { $obj2->initAsistencias(); - $obj2->addAsistencia($obj1); //CHECKME - } + $obj2->addAsistencia($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AsistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AsistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -535,25 +363,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Asistencia objects pre-filled with all related objects. - * - * @return array Array of Asistencia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -583,8 +403,7 @@ $obj1->hydrate($rs); - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -595,11 +414,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addAsistencia($obj1); // CHECKME - break; + $temp_obj2->addAsistencia($obj1); break; } } @@ -609,8 +426,7 @@ } - // Add objects for joined Tipoasistencia rows - + $omClass = TipoasistenciaPeer::getOMClass(); @@ -621,11 +437,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipoasistencia(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipoasistencia(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addAsistencia($obj1); // CHECKME - break; + $temp_obj3->addAsistencia($obj1); break; } } @@ -640,29 +454,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AsistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AsistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -673,35 +477,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipoasistencia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipoasistencia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(AsistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(AsistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -712,27 +505,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Asistencia objects pre-filled with all related objects except Alumno. - * - * @return array Array of Asistencia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -766,8 +549,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoasistencia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoasistencia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAsistencia($obj1); break; @@ -785,21 +567,12 @@ } - /** - * Selects a collection of Asistencia objects pre-filled with all related objects except Tipoasistencia. - * - * @return array Array of Asistencia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipoasistencia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -833,8 +606,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addAsistencia($obj1); break; @@ -851,41 +623,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return AsistenciaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Asistencia or Criteria object. - * - * @param mixed $values Criteria or Asistencia object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -893,21 +643,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Asistencia object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(AsistenciaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(AsistenciaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -918,15 +662,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Asistencia or Criteria object. - * - * @param mixed $values Criteria or Asistencia object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -936,37 +672,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(AsistenciaPeer::ID); $selectCriteria->add(AsistenciaPeer::ID, $criteria->remove(AsistenciaPeer::ID), $comparison); - } else { // $values is Asistencia object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the asistencia table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(AsistenciaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -976,17 +700,7 @@ } } - /** - * Method perform a DELETE on the database, given a Asistencia or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Asistencia object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -994,25 +708,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Asistencia) { + $criteria = clone $values; } elseif ($values instanceof Asistencia) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(AsistenciaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1023,18 +731,7 @@ } } - /** - * Validates all modified columns of given Asistencia object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Asistencia $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Asistencia $obj, $cols = null) { $columns = array(); @@ -1069,13 +766,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Asistencia - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1092,14 +783,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1117,20 +801,14 @@ return $objs; } -} // BaseAsistenciaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseAsistenciaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/AsistenciaMapBuilder.php'; - Propel::registerMapBuilder('model.map.AsistenciaMapBuilder'); + require_once 'lib/model/map/AsistenciaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.AsistenciaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividades.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividades.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividades.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,202 +1,109 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - -include_once 'creole/util/Clob.php'; -include_once 'creole/util/Blob.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/BoletinActividadesPeer.php'; - -/** - * Base class that represents a row from the 'boletin_actividades' table. - * - * - * - * @package model.om - */ abstract class BaseBoletinActividades extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var BoletinActividadesPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_escalanota_id field. - * @var int - */ + protected $fk_escalanota_id = 0; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id = 0; - /** - * The value for the fk_actividad_id field. - * @var int - */ + protected $fk_actividad_id = 0; - /** - * The value for the fk_periodo_id field. - * @var int - */ + protected $fk_periodo_id = 0; - /** - * The value for the observacion field. - * @var string - */ + protected $observacion; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * @var Escalanota - */ + protected $aEscalanota; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * @var Actividad - */ + protected $aActividad; - /** - * @var Periodo - */ + protected $aPeriodo; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_escalanota_id] column value. - * - * @return int - */ + public function getFkEscalanotaId() { return $this->fk_escalanota_id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Get the [fk_actividad_id] column value. - * - * @return int - */ + public function getFkActividadId() { return $this->fk_actividad_id; } - /** - * Get the [fk_periodo_id] column value. - * - * @return int - */ + public function getFkPeriodoId() { return $this->fk_periodo_id; } - /** - * Get the [observacion] column value. - * - * @return string - */ + public function getObservacion() { return $this->observacion; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -210,12 +117,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -224,14 +126,8 @@ $this->modifiedColumns[] = BoletinActividadesPeer::ID; } - } // setId() - - /** - * Set the value of [fk_escalanota_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEscalanotaId($v) { @@ -244,14 +140,8 @@ $this->aEscalanota = null; } - } // setFkEscalanotaId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -264,14 +154,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Set the value of [fk_actividad_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkActividadId($v) { @@ -284,14 +168,8 @@ $this->aActividad = null; } - } // setFkActividadId() - - /** - * Set the value of [fk_periodo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPeriodoId($v) { @@ -304,21 +182,12 @@ $this->aPeriodo = null; } - } // setFkPeriodoId() - - /** - * Set the value of [observacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setObservacion($v) { - // if the passed in parameter is the *same* object that - // is stored internally then we use the Lob->isModified() - // method to know whether contents changed. - if ($v instanceof Lob && $v === $this->observacion) { + if ($v instanceof Lob && $v === $this->observacion) { $changed = $v->isModified(); } else { $changed = ($this->observacion !== $v); @@ -334,21 +203,14 @@ $this->modifiedColumns[] = BoletinActividadesPeer::OBSERVACION; } - } // setObservacion() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -358,21 +220,8 @@ $this->modifiedColumns[] = BoletinActividadesPeer::FECHA; } - } // setFecha() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -395,23 +244,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 7; // 7 = BoletinActividadesPeer::NUM_COLUMNS - BoletinActividadesPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 7; } catch (Exception $e) { throw new PropelException("Error populating BoletinActividades object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -433,16 +272,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -464,29 +294,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEscalanota !== null) { if ($this->aEscalanota->isModified()) { $affectedRows += $this->aEscalanota->save($con); @@ -516,57 +331,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = BoletinActividadesPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += BoletinActividadesPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -579,16 +368,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -598,11 +378,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEscalanota !== null) { if (!$this->aEscalanota->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEscalanota->getValidationFailures()); @@ -640,28 +416,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = BoletinActividadesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -689,19 +451,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = BoletinActividadesPeer::getFieldNames($keyType); @@ -717,30 +469,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = BoletinActividadesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -765,25 +501,9 @@ case 6: $this->setFecha($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = BoletinActividadesPeer::getFieldNames($keyType); @@ -797,11 +517,7 @@ if (array_key_exists($keys[6], $arr)) $this->setFecha($arr[$keys[6]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(BoletinActividadesPeer::DATABASE_NAME); @@ -817,14 +533,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(BoletinActividadesPeer::DATABASE_NAME); @@ -834,36 +543,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of BoletinActividades (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -882,40 +574,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return BoletinActividades Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return BoletinActividadesPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -924,13 +595,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Escalanota object. - * - * @param Escalanota $v - * @return void - * @throws PropelException - */ + public function setEscalanota($v) { @@ -946,42 +611,21 @@ } - /** - * Get the associated Escalanota object - * - * @param Connection Optional Connection object. - * @return Escalanota The associated Escalanota object. - * @throws PropelException - */ + public function getEscalanota($con = null) { - // include the related Peer class - include_once 'model/om/BaseEscalanotaPeer.php'; + include_once 'lib/model/om/BaseEscalanotaPeer.php'; if ($this->aEscalanota === null && ($this->fk_escalanota_id !== null)) { $this->aEscalanota = EscalanotaPeer::retrieveByPK($this->fk_escalanota_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EscalanotaPeer::retrieveByPK($this->fk_escalanota_id, $con); - $obj->addEscalanotas($this); - */ + } return $this->aEscalanota; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -997,42 +641,21 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } - /** - * Declares an association between this object and a Actividad object. - * - * @param Actividad $v - * @return void - * @throws PropelException - */ + public function setActividad($v) { @@ -1048,42 +671,21 @@ } - /** - * Get the associated Actividad object - * - * @param Connection Optional Connection object. - * @return Actividad The associated Actividad object. - * @throws PropelException - */ + public function getActividad($con = null) { - // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { $this->aActividad = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - $obj->addActividads($this); - */ + } return $this->aActividad; } - /** - * Declares an association between this object and a Periodo object. - * - * @param Periodo $v - * @return void - * @throws PropelException - */ + public function setPeriodo($v) { @@ -1099,33 +701,18 @@ } - /** - * Get the associated Periodo object - * - * @param Connection Optional Connection object. - * @return Periodo The associated Periodo object. - * @throws PropelException - */ + public function getPeriodo($con = null) { - // include the related Peer class - include_once 'model/om/BasePeriodoPeer.php'; + include_once 'lib/model/om/BasePeriodoPeer.php'; if ($this->aPeriodo === null && ($this->fk_periodo_id !== null)) { $this->aPeriodo = PeriodoPeer::retrieveByPK($this->fk_periodo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PeriodoPeer::retrieveByPK($this->fk_periodo_id, $con); - $obj->addPeriodos($this); - */ + } return $this->aPeriodo; } -} // BaseBoletinActividades +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividadesPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividadesPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseBoletinActividadesPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,66 +1,50 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by BoletinActividadesPeer::getOMClass() -include_once 'model/BoletinActividades.php'; -/** - * Base static class for performing query and update operations on the 'boletin_actividades' table. - * - * - * - * @package model.om - */ abstract class BaseBoletinActividadesPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'boletin_actividades'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.BoletinActividades'; + + const CLASS_DEFAULT = 'lib.model.BoletinActividades'; - /** The total number of columns. */ + const NUM_COLUMNS = 7; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'boletin_actividades.ID'; - /** the column name for the FK_ESCALANOTA_ID field */ + const FK_ESCALANOTA_ID = 'boletin_actividades.FK_ESCALANOTA_ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'boletin_actividades.FK_ALUMNO_ID'; - /** the column name for the FK_ACTIVIDAD_ID field */ + const FK_ACTIVIDAD_ID = 'boletin_actividades.FK_ACTIVIDAD_ID'; - /** the column name for the FK_PERIODO_ID field */ + const FK_PERIODO_ID = 'boletin_actividades.FK_PERIODO_ID'; - /** the column name for the OBSERVACION field */ + const OBSERVACION = 'boletin_actividades.OBSERVACION'; - /** the column name for the FECHA field */ + const FECHA = 'boletin_actividades.FECHA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEscalanotaId', 'FkAlumnoId', 'FkActividadId', 'FkPeriodoId', 'Observacion', 'Fecha', ), BasePeer::TYPE_COLNAME => array (BoletinActividadesPeer::ID, BoletinActividadesPeer::FK_ESCALANOTA_ID, BoletinActividadesPeer::FK_ALUMNO_ID, BoletinActividadesPeer::FK_ACTIVIDAD_ID, BoletinActividadesPeer::FK_PERIODO_ID, BoletinActividadesPeer::OBSERVACION, BoletinActividadesPeer::FECHA, ), @@ -68,12 +52,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEscalanotaId' => 1, 'FkAlumnoId' => 2, 'FkActividadId' => 3, 'FkPeriodoId' => 4, 'Observacion' => 5, 'Fecha' => 6, ), BasePeer::TYPE_COLNAME => array (BoletinActividadesPeer::ID => 0, BoletinActividadesPeer::FK_ESCALANOTA_ID => 1, BoletinActividadesPeer::FK_ALUMNO_ID => 2, BoletinActividadesPeer::FK_ACTIVIDAD_ID => 3, BoletinActividadesPeer::FK_PERIODO_ID => 4, BoletinActividadesPeer::OBSERVACION => 5, BoletinActividadesPeer::FECHA => 6, ), @@ -81,24 +60,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/BoletinActividadesMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.BoletinActividadesMapBuilder'); + include_once 'lib/model/map/BoletinActividadesMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.BoletinActividadesMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -112,15 +80,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -131,14 +91,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -148,34 +101,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. BoletinActividadesPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(BoletinActividadesPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -198,29 +130,19 @@ const COUNT = 'COUNT(boletin_actividades.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT boletin_actividades.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -229,19 +151,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return BoletinActividades - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -252,33 +165,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return BoletinActividadesPeer::populateObjects(BoletinActividadesPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -290,29 +182,18 @@ BoletinActividadesPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = BoletinActividadesPeer::getOMClass(); + $cls = BoletinActividadesPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -322,29 +203,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Escalanota table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEscalanota(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -355,35 +226,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -394,35 +254,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -433,35 +282,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Periodo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPeriodo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -472,25 +310,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of BoletinActividades objects pre-filled with their Escalanota objects. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEscalanota(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -518,37 +348,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinActividades($obj1); //CHECKME - break; + $temp_obj2->addBoletinActividades($obj1); break; } } if ($newObject) { $obj2->initBoletinActividadess(); - $obj2->addBoletinActividades($obj1); //CHECKME - } + $obj2->addBoletinActividades($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of BoletinActividades objects pre-filled with their Alumno objects. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -576,37 +395,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinActividades($obj1); //CHECKME - break; + $temp_obj2->addBoletinActividades($obj1); break; } } if ($newObject) { $obj2->initBoletinActividadess(); - $obj2->addBoletinActividades($obj1); //CHECKME - } + $obj2->addBoletinActividades($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of BoletinActividades objects pre-filled with their Actividad objects. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -634,37 +442,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinActividades($obj1); //CHECKME - break; + $temp_obj2->addBoletinActividades($obj1); break; } } if ($newObject) { $obj2->initBoletinActividadess(); - $obj2->addBoletinActividades($obj1); //CHECKME - } + $obj2->addBoletinActividades($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of BoletinActividades objects pre-filled with their Periodo objects. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPeriodo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -692,46 +489,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPeriodo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinActividades($obj1); //CHECKME - break; + $temp_obj2->addBoletinActividades($obj1); break; } } if ($newObject) { $obj2->initBoletinActividadess(); - $obj2->addBoletinActividades($obj1); //CHECKME - } + $obj2->addBoletinActividades($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -748,25 +532,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of BoletinActividades objects pre-filled with all related objects. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -806,8 +582,7 @@ $obj1->hydrate($rs); - // Add objects for joined Escalanota rows - + $omClass = EscalanotaPeer::getOMClass(); @@ -818,11 +593,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addBoletinActividades($obj1); // CHECKME - break; + $temp_obj2->addBoletinActividades($obj1); break; } } @@ -832,8 +605,7 @@ } - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -844,11 +616,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addBoletinActividades($obj1); // CHECKME - break; + $temp_obj3->addBoletinActividades($obj1); break; } } @@ -858,8 +628,7 @@ } - // Add objects for joined Actividad rows - + $omClass = ActividadPeer::getOMClass(); @@ -870,11 +639,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getActividad(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getActividad(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addBoletinActividades($obj1); // CHECKME - break; + $temp_obj4->addBoletinActividades($obj1); break; } } @@ -884,8 +651,7 @@ } - // Add objects for joined Periodo rows - + $omClass = PeriodoPeer::getOMClass(); @@ -896,11 +662,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getPeriodo(); // CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getPeriodo(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; - $temp_obj5->addBoletinActividades($obj1); // CHECKME - break; + $temp_obj5->addBoletinActividades($obj1); break; } } @@ -915,29 +679,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Escalanota table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEscalanota(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -952,35 +706,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -995,35 +738,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1038,35 +770,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Periodo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptPeriodo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinActividadesPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1081,27 +802,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of BoletinActividades objects pre-filled with all related objects except Escalanota. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEscalanota(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1145,8 +856,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinActividades($obj1); break; @@ -1168,8 +878,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getActividad(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinActividades($obj1); break; @@ -1191,8 +900,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinActividades($obj1); break; @@ -1210,21 +918,12 @@ } - /** - * Selects a collection of BoletinActividades objects pre-filled with all related objects except Alumno. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1268,8 +967,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinActividades($obj1); break; @@ -1291,8 +989,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getActividad(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinActividades($obj1); break; @@ -1314,8 +1011,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinActividades($obj1); break; @@ -1333,21 +1029,12 @@ } - /** - * Selects a collection of BoletinActividades objects pre-filled with all related objects except Actividad. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1391,8 +1078,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinActividades($obj1); break; @@ -1414,8 +1100,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinActividades($obj1); break; @@ -1437,8 +1122,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinActividades($obj1); break; @@ -1456,21 +1140,12 @@ } - /** - * Selects a collection of BoletinActividades objects pre-filled with all related objects except Periodo. - * - * @return array Array of BoletinActividades objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptPeriodo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1514,8 +1189,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinActividades($obj1); break; @@ -1537,8 +1211,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinActividades($obj1); break; @@ -1560,8 +1233,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getActividad(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinActividades($obj1); break; @@ -1578,41 +1250,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return BoletinActividadesPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a BoletinActividades or Criteria object. - * - * @param mixed $values Criteria or BoletinActividades object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1620,21 +1270,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from BoletinActividades object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(BoletinActividadesPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(BoletinActividadesPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1645,15 +1289,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a BoletinActividades or Criteria object. - * - * @param mixed $values Criteria or BoletinActividades object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1663,37 +1299,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(BoletinActividadesPeer::ID); $selectCriteria->add(BoletinActividadesPeer::ID, $criteria->remove(BoletinActividadesPeer::ID), $comparison); - } else { // $values is BoletinActividades object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the boletin_actividades table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(BoletinActividadesPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1703,17 +1327,7 @@ } } - /** - * Method perform a DELETE on the database, given a BoletinActividades or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or BoletinActividades object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1721,25 +1335,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof BoletinActividades) { + $criteria = clone $values; } elseif ($values instanceof BoletinActividades) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(BoletinActividadesPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1750,18 +1358,7 @@ } } - /** - * Validates all modified columns of given BoletinActividades object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param BoletinActividades $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(BoletinActividades $obj, $cols = null) { $columns = array(); @@ -1796,13 +1393,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return BoletinActividades - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1819,14 +1410,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1844,20 +1428,14 @@ return $objs; } -} // BaseBoletinActividadesPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseBoletinActividadesPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/BoletinActividadesMapBuilder.php'; - Propel::registerMapBuilder('model.map.BoletinActividadesMapBuilder'); + require_once 'lib/model/map/BoletinActividadesMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.BoletinActividadesMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptual.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptual.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptual.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,202 +1,109 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - -include_once 'creole/util/Clob.php'; -include_once 'creole/util/Blob.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/BoletinConceptualPeer.php'; - -/** - * Base class that represents a row from the 'boletin_conceptual' table. - * - * - * - * @package model.om - */ abstract class BaseBoletinConceptual extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var BoletinConceptualPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_escalanota_id field. - * @var int - */ + protected $fk_escalanota_id = 0; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id = 0; - /** - * The value for the fk_concepto_id field. - * @var int - */ + protected $fk_concepto_id = 0; - /** - * The value for the fk_periodo_id field. - * @var int - */ + protected $fk_periodo_id = 0; - /** - * The value for the observacion field. - * @var string - */ + protected $observacion; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * @var Escalanota - */ + protected $aEscalanota; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * @var Concepto - */ + protected $aConcepto; - /** - * @var Periodo - */ + protected $aPeriodo; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_escalanota_id] column value. - * - * @return int - */ + public function getFkEscalanotaId() { return $this->fk_escalanota_id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Get the [fk_concepto_id] column value. - * - * @return int - */ + public function getFkConceptoId() { return $this->fk_concepto_id; } - /** - * Get the [fk_periodo_id] column value. - * - * @return int - */ + public function getFkPeriodoId() { return $this->fk_periodo_id; } - /** - * Get the [observacion] column value. - * - * @return string - */ + public function getObservacion() { return $this->observacion; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -210,12 +117,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -224,14 +126,8 @@ $this->modifiedColumns[] = BoletinConceptualPeer::ID; } - } // setId() - - /** - * Set the value of [fk_escalanota_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEscalanotaId($v) { @@ -244,14 +140,8 @@ $this->aEscalanota = null; } - } // setFkEscalanotaId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -264,14 +154,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Set the value of [fk_concepto_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkConceptoId($v) { @@ -284,14 +168,8 @@ $this->aConcepto = null; } - } // setFkConceptoId() - - /** - * Set the value of [fk_periodo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPeriodoId($v) { @@ -304,21 +182,12 @@ $this->aPeriodo = null; } - } // setFkPeriodoId() - - /** - * Set the value of [observacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setObservacion($v) { - // if the passed in parameter is the *same* object that - // is stored internally then we use the Lob->isModified() - // method to know whether contents changed. - if ($v instanceof Lob && $v === $this->observacion) { + if ($v instanceof Lob && $v === $this->observacion) { $changed = $v->isModified(); } else { $changed = ($this->observacion !== $v); @@ -334,21 +203,14 @@ $this->modifiedColumns[] = BoletinConceptualPeer::OBSERVACION; } - } // setObservacion() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -358,21 +220,8 @@ $this->modifiedColumns[] = BoletinConceptualPeer::FECHA; } - } // setFecha() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -395,23 +244,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 7; // 7 = BoletinConceptualPeer::NUM_COLUMNS - BoletinConceptualPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 7; } catch (Exception $e) { throw new PropelException("Error populating BoletinConceptual object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -433,16 +272,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -464,29 +294,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEscalanota !== null) { if ($this->aEscalanota->isModified()) { $affectedRows += $this->aEscalanota->save($con); @@ -516,57 +331,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = BoletinConceptualPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += BoletinConceptualPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -579,16 +368,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -598,11 +378,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEscalanota !== null) { if (!$this->aEscalanota->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEscalanota->getValidationFailures()); @@ -640,28 +416,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = BoletinConceptualPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -689,19 +451,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = BoletinConceptualPeer::getFieldNames($keyType); @@ -717,30 +469,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = BoletinConceptualPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -765,25 +501,9 @@ case 6: $this->setFecha($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = BoletinConceptualPeer::getFieldNames($keyType); @@ -797,11 +517,7 @@ if (array_key_exists($keys[6], $arr)) $this->setFecha($arr[$keys[6]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(BoletinConceptualPeer::DATABASE_NAME); @@ -817,14 +533,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(BoletinConceptualPeer::DATABASE_NAME); @@ -834,36 +543,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of BoletinConceptual (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -882,40 +574,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return BoletinConceptual Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return BoletinConceptualPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -924,13 +595,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Escalanota object. - * - * @param Escalanota $v - * @return void - * @throws PropelException - */ + public function setEscalanota($v) { @@ -946,42 +611,21 @@ } - /** - * Get the associated Escalanota object - * - * @param Connection Optional Connection object. - * @return Escalanota The associated Escalanota object. - * @throws PropelException - */ + public function getEscalanota($con = null) { - // include the related Peer class - include_once 'model/om/BaseEscalanotaPeer.php'; + include_once 'lib/model/om/BaseEscalanotaPeer.php'; if ($this->aEscalanota === null && ($this->fk_escalanota_id !== null)) { $this->aEscalanota = EscalanotaPeer::retrieveByPK($this->fk_escalanota_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EscalanotaPeer::retrieveByPK($this->fk_escalanota_id, $con); - $obj->addEscalanotas($this); - */ + } return $this->aEscalanota; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -997,42 +641,21 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } - /** - * Declares an association between this object and a Concepto object. - * - * @param Concepto $v - * @return void - * @throws PropelException - */ + public function setConcepto($v) { @@ -1048,42 +671,21 @@ } - /** - * Get the associated Concepto object - * - * @param Connection Optional Connection object. - * @return Concepto The associated Concepto object. - * @throws PropelException - */ + public function getConcepto($con = null) { - // include the related Peer class - include_once 'model/om/BaseConceptoPeer.php'; + include_once 'lib/model/om/BaseConceptoPeer.php'; if ($this->aConcepto === null && ($this->fk_concepto_id !== null)) { $this->aConcepto = ConceptoPeer::retrieveByPK($this->fk_concepto_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ConceptoPeer::retrieveByPK($this->fk_concepto_id, $con); - $obj->addConceptos($this); - */ + } return $this->aConcepto; } - /** - * Declares an association between this object and a Periodo object. - * - * @param Periodo $v - * @return void - * @throws PropelException - */ + public function setPeriodo($v) { @@ -1099,33 +701,18 @@ } - /** - * Get the associated Periodo object - * - * @param Connection Optional Connection object. - * @return Periodo The associated Periodo object. - * @throws PropelException - */ + public function getPeriodo($con = null) { - // include the related Peer class - include_once 'model/om/BasePeriodoPeer.php'; + include_once 'lib/model/om/BasePeriodoPeer.php'; if ($this->aPeriodo === null && ($this->fk_periodo_id !== null)) { $this->aPeriodo = PeriodoPeer::retrieveByPK($this->fk_periodo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PeriodoPeer::retrieveByPK($this->fk_periodo_id, $con); - $obj->addPeriodos($this); - */ + } return $this->aPeriodo; } -} // BaseBoletinConceptual +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptualPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptualPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseBoletinConceptualPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,66 +1,50 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by BoletinConceptualPeer::getOMClass() -include_once 'model/BoletinConceptual.php'; -/** - * Base static class for performing query and update operations on the 'boletin_conceptual' table. - * - * - * - * @package model.om - */ abstract class BaseBoletinConceptualPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'boletin_conceptual'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.BoletinConceptual'; + + const CLASS_DEFAULT = 'lib.model.BoletinConceptual'; - /** The total number of columns. */ + const NUM_COLUMNS = 7; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'boletin_conceptual.ID'; - /** the column name for the FK_ESCALANOTA_ID field */ + const FK_ESCALANOTA_ID = 'boletin_conceptual.FK_ESCALANOTA_ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'boletin_conceptual.FK_ALUMNO_ID'; - /** the column name for the FK_CONCEPTO_ID field */ + const FK_CONCEPTO_ID = 'boletin_conceptual.FK_CONCEPTO_ID'; - /** the column name for the FK_PERIODO_ID field */ + const FK_PERIODO_ID = 'boletin_conceptual.FK_PERIODO_ID'; - /** the column name for the OBSERVACION field */ + const OBSERVACION = 'boletin_conceptual.OBSERVACION'; - /** the column name for the FECHA field */ + const FECHA = 'boletin_conceptual.FECHA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEscalanotaId', 'FkAlumnoId', 'FkConceptoId', 'FkPeriodoId', 'Observacion', 'Fecha', ), BasePeer::TYPE_COLNAME => array (BoletinConceptualPeer::ID, BoletinConceptualPeer::FK_ESCALANOTA_ID, BoletinConceptualPeer::FK_ALUMNO_ID, BoletinConceptualPeer::FK_CONCEPTO_ID, BoletinConceptualPeer::FK_PERIODO_ID, BoletinConceptualPeer::OBSERVACION, BoletinConceptualPeer::FECHA, ), @@ -68,12 +52,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEscalanotaId' => 1, 'FkAlumnoId' => 2, 'FkConceptoId' => 3, 'FkPeriodoId' => 4, 'Observacion' => 5, 'Fecha' => 6, ), BasePeer::TYPE_COLNAME => array (BoletinConceptualPeer::ID => 0, BoletinConceptualPeer::FK_ESCALANOTA_ID => 1, BoletinConceptualPeer::FK_ALUMNO_ID => 2, BoletinConceptualPeer::FK_CONCEPTO_ID => 3, BoletinConceptualPeer::FK_PERIODO_ID => 4, BoletinConceptualPeer::OBSERVACION => 5, BoletinConceptualPeer::FECHA => 6, ), @@ -81,24 +60,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/BoletinConceptualMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.BoletinConceptualMapBuilder'); + include_once 'lib/model/map/BoletinConceptualMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.BoletinConceptualMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -112,15 +80,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -131,14 +91,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -148,34 +101,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. BoletinConceptualPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(BoletinConceptualPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -198,29 +130,19 @@ const COUNT = 'COUNT(boletin_conceptual.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT boletin_conceptual.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -229,19 +151,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return BoletinConceptual - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -252,33 +165,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return BoletinConceptualPeer::populateObjects(BoletinConceptualPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -290,29 +182,18 @@ BoletinConceptualPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = BoletinConceptualPeer::getOMClass(); + $cls = BoletinConceptualPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -322,29 +203,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Escalanota table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEscalanota(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -355,35 +226,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -394,35 +254,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Concepto table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinConcepto(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -433,35 +282,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Periodo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPeriodo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -472,25 +310,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of BoletinConceptual objects pre-filled with their Escalanota objects. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEscalanota(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -518,37 +348,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinConceptual($obj1); //CHECKME - break; + $temp_obj2->addBoletinConceptual($obj1); break; } } if ($newObject) { $obj2->initBoletinConceptuals(); - $obj2->addBoletinConceptual($obj1); //CHECKME - } + $obj2->addBoletinConceptual($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of BoletinConceptual objects pre-filled with their Alumno objects. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -576,37 +395,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinConceptual($obj1); //CHECKME - break; + $temp_obj2->addBoletinConceptual($obj1); break; } } if ($newObject) { $obj2->initBoletinConceptuals(); - $obj2->addBoletinConceptual($obj1); //CHECKME - } + $obj2->addBoletinConceptual($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of BoletinConceptual objects pre-filled with their Concepto objects. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinConcepto(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -634,37 +442,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getConcepto(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getConcepto(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinConceptual($obj1); //CHECKME - break; + $temp_obj2->addBoletinConceptual($obj1); break; } } if ($newObject) { $obj2->initBoletinConceptuals(); - $obj2->addBoletinConceptual($obj1); //CHECKME - } + $obj2->addBoletinConceptual($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of BoletinConceptual objects pre-filled with their Periodo objects. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPeriodo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -692,46 +489,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPeriodo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addBoletinConceptual($obj1); //CHECKME - break; + $temp_obj2->addBoletinConceptual($obj1); break; } } if ($newObject) { $obj2->initBoletinConceptuals(); - $obj2->addBoletinConceptual($obj1); //CHECKME - } + $obj2->addBoletinConceptual($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -748,25 +532,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of BoletinConceptual objects pre-filled with all related objects. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -806,8 +582,7 @@ $obj1->hydrate($rs); - // Add objects for joined Escalanota rows - + $omClass = EscalanotaPeer::getOMClass(); @@ -818,11 +593,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addBoletinConceptual($obj1); // CHECKME - break; + $temp_obj2->addBoletinConceptual($obj1); break; } } @@ -832,8 +605,7 @@ } - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -844,11 +616,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addBoletinConceptual($obj1); // CHECKME - break; + $temp_obj3->addBoletinConceptual($obj1); break; } } @@ -858,8 +628,7 @@ } - // Add objects for joined Concepto rows - + $omClass = ConceptoPeer::getOMClass(); @@ -870,11 +639,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getConcepto(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getConcepto(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addBoletinConceptual($obj1); // CHECKME - break; + $temp_obj4->addBoletinConceptual($obj1); break; } } @@ -884,8 +651,7 @@ } - // Add objects for joined Periodo rows - + $omClass = PeriodoPeer::getOMClass(); @@ -896,11 +662,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getPeriodo(); // CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getPeriodo(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; - $temp_obj5->addBoletinConceptual($obj1); // CHECKME - break; + $temp_obj5->addBoletinConceptual($obj1); break; } } @@ -915,29 +679,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Escalanota table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEscalanota(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -952,35 +706,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -995,35 +738,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Concepto table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptConcepto(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1038,35 +770,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Periodo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptPeriodo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(BoletinConceptualPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1081,27 +802,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of BoletinConceptual objects pre-filled with all related objects except Escalanota. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEscalanota(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1145,8 +856,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinConceptual($obj1); break; @@ -1168,8 +878,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getConcepto(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getConcepto(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinConceptual($obj1); break; @@ -1191,8 +900,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinConceptual($obj1); break; @@ -1210,21 +918,12 @@ } - /** - * Selects a collection of BoletinConceptual objects pre-filled with all related objects except Alumno. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1268,8 +967,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinConceptual($obj1); break; @@ -1291,8 +989,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getConcepto(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getConcepto(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinConceptual($obj1); break; @@ -1314,8 +1011,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinConceptual($obj1); break; @@ -1333,21 +1029,12 @@ } - /** - * Selects a collection of BoletinConceptual objects pre-filled with all related objects except Concepto. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptConcepto(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1391,8 +1078,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinConceptual($obj1); break; @@ -1414,8 +1100,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinConceptual($obj1); break; @@ -1437,8 +1122,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinConceptual($obj1); break; @@ -1456,21 +1140,12 @@ } - /** - * Selects a collection of BoletinConceptual objects pre-filled with all related objects except Periodo. - * - * @return array Array of BoletinConceptual objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptPeriodo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1514,8 +1189,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addBoletinConceptual($obj1); break; @@ -1537,8 +1211,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addBoletinConceptual($obj1); break; @@ -1560,8 +1233,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getConcepto(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getConcepto(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addBoletinConceptual($obj1); break; @@ -1578,41 +1250,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return BoletinConceptualPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a BoletinConceptual or Criteria object. - * - * @param mixed $values Criteria or BoletinConceptual object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1620,21 +1270,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from BoletinConceptual object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(BoletinConceptualPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(BoletinConceptualPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1645,15 +1289,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a BoletinConceptual or Criteria object. - * - * @param mixed $values Criteria or BoletinConceptual object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1663,37 +1299,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(BoletinConceptualPeer::ID); $selectCriteria->add(BoletinConceptualPeer::ID, $criteria->remove(BoletinConceptualPeer::ID), $comparison); - } else { // $values is BoletinConceptual object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the boletin_conceptual table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(BoletinConceptualPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1703,17 +1327,7 @@ } } - /** - * Method perform a DELETE on the database, given a BoletinConceptual or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or BoletinConceptual object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1721,25 +1335,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof BoletinConceptual) { + $criteria = clone $values; } elseif ($values instanceof BoletinConceptual) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(BoletinConceptualPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1750,18 +1358,7 @@ } } - /** - * Validates all modified columns of given BoletinConceptual object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param BoletinConceptual $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(BoletinConceptual $obj, $cols = null) { $columns = array(); @@ -1796,13 +1393,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return BoletinConceptual - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1819,14 +1410,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1844,20 +1428,14 @@ return $objs; } -} // BaseBoletinConceptualPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseBoletinConceptualPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/BoletinConceptualMapBuilder.php'; - Propel::registerMapBuilder('model.map.BoletinConceptualMapBuilder'); + require_once 'lib/model/map/BoletinConceptualMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.BoletinConceptualMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,154 +1,80 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/CalendariovacunacionPeer.php'; - -/** - * Base class that represents a row from the 'calendariovacunacion' table. - * - * - * - * @package model.om - */ abstract class BaseCalendariovacunacion extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var CalendariovacunacionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the periodo field. - * @var string - */ + protected $periodo; - /** - * The value for the observacion field. - * @var string - */ + protected $observacion = ''; - /** - * Collection to store aggregation of collRelCalendariovacunacionAlumnos. - * @var array - */ + protected $collRelCalendariovacunacionAlumnos; - /** - * The criteria used to select the current contents of collRelCalendariovacunacionAlumnos. - * @var Criteria - */ + protected $lastRelCalendariovacunacionAlumnoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [periodo] column value. - * - * @return string - */ + public function getPeriodo() { return $this->periodo; } - /** - * Get the [observacion] column value. - * - * @return string - */ + public function getObservacion() { return $this->observacion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -157,14 +83,8 @@ $this->modifiedColumns[] = CalendariovacunacionPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -173,14 +93,8 @@ $this->modifiedColumns[] = CalendariovacunacionPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -189,14 +103,8 @@ $this->modifiedColumns[] = CalendariovacunacionPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [periodo] column. - * - * @param string $v new value - * @return void - */ + } + public function setPeriodo($v) { @@ -205,14 +113,8 @@ $this->modifiedColumns[] = CalendariovacunacionPeer::PERIODO; } - } // setPeriodo() - - /** - * Set the value of [observacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setObservacion($v) { @@ -221,21 +123,8 @@ $this->modifiedColumns[] = CalendariovacunacionPeer::OBSERVACION; } - } // setObservacion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -254,23 +143,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = CalendariovacunacionPeer::NUM_COLUMNS - CalendariovacunacionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Calendariovacunacion object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -292,16 +171,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -323,40 +193,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = CalendariovacunacionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += CalendariovacunacionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelCalendariovacunacionAlumnos !== null) { foreach($this->collRelCalendariovacunacionAlumnos as $referrerFK) { @@ -369,37 +222,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -412,16 +245,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -451,28 +275,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = CalendariovacunacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -494,19 +304,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = CalendariovacunacionPeer::getFieldNames($keyType); @@ -520,30 +320,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = CalendariovacunacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -562,25 +346,9 @@ case 4: $this->setObservacion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CalendariovacunacionPeer::getFieldNames($keyType); @@ -592,11 +360,7 @@ if (array_key_exists($keys[4], $arr)) $this->setObservacion($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(CalendariovacunacionPeer::DATABASE_NAME); @@ -610,14 +374,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(CalendariovacunacionPeer::DATABASE_NAME); @@ -627,36 +384,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Calendariovacunacion (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -670,53 +410,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelCalendariovacunacionAlumnos() as $relObj) { $copyObj->addRelCalendariovacunacionAlumno($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Calendariovacunacion Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CalendariovacunacionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -725,12 +441,7 @@ return self::$peer; } - /** - * Temporary storage of collRelCalendariovacunacionAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelCalendariovacunacionAlumnos() { if ($this->collRelCalendariovacunacionAlumnos === null) { @@ -738,23 +449,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Calendariovacunacion has previously - * been saved, it will retrieve related RelCalendariovacunacionAlumnos from storage. - * If this Calendariovacunacion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelCalendariovacunacionAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + include_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -774,13 +472,9 @@ $this->collRelCalendariovacunacionAlumnos = RelCalendariovacunacionAlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelCalendariovacunacionAlumnoPeer::FK_CALENDARIOVACUNACION_ID, $this->getId()); RelCalendariovacunacionAlumnoPeer::addSelectColumns($criteria); @@ -793,18 +487,10 @@ return $this->collRelCalendariovacunacionAlumnos; } - /** - * Returns the number of related RelCalendariovacunacionAlumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelCalendariovacunacionAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + include_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -818,14 +504,7 @@ return RelCalendariovacunacionAlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelCalendariovacunacionAlumno object to this object - * through the RelCalendariovacunacionAlumno foreign key attribute - * - * @param RelCalendariovacunacionAlumno $l RelCalendariovacunacionAlumno - * @return void - * @throws PropelException - */ + public function addRelCalendariovacunacionAlumno(RelCalendariovacunacionAlumno $l) { $this->collRelCalendariovacunacionAlumnos[] = $l; @@ -833,21 +512,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Calendariovacunacion is new, it will return - * an empty collection; or if this Calendariovacunacion has previously - * been saved, it will retrieve related RelCalendariovacunacionAlumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Calendariovacunacion. - */ + public function getRelCalendariovacunacionAlumnosJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; + include_once 'lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -866,10 +534,7 @@ $this->collRelCalendariovacunacionAlumnos = RelCalendariovacunacionAlumnoPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelCalendariovacunacionAlumnoPeer::FK_CALENDARIOVACUNACION_ID, $this->getId()); if (!isset($this->lastRelCalendariovacunacionAlumnoCriteria) || !$this->lastRelCalendariovacunacionAlumnoCriteria->equals($criteria)) { @@ -881,4 +546,4 @@ return $this->collRelCalendariovacunacionAlumnos; } -} // BaseCalendariovacunacion +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCalendariovacunacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by CalendariovacunacionPeer::getOMClass() -include_once 'model/Calendariovacunacion.php'; -/** - * Base static class for performing query and update operations on the 'calendariovacunacion' table. - * - * - * - * @package model.om - */ abstract class BaseCalendariovacunacionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'calendariovacunacion'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Calendariovacunacion'; + + const CLASS_DEFAULT = 'lib.model.Calendariovacunacion'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'calendariovacunacion.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'calendariovacunacion.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'calendariovacunacion.DESCRIPCION'; - /** the column name for the PERIODO field */ + const PERIODO = 'calendariovacunacion.PERIODO'; - /** the column name for the OBSERVACION field */ + const OBSERVACION = 'calendariovacunacion.OBSERVACION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'Periodo', 'Observacion', ), BasePeer::TYPE_COLNAME => array (CalendariovacunacionPeer::ID, CalendariovacunacionPeer::NOMBRE, CalendariovacunacionPeer::DESCRIPCION, CalendariovacunacionPeer::PERIODO, CalendariovacunacionPeer::OBSERVACION, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'Periodo' => 3, 'Observacion' => 4, ), BasePeer::TYPE_COLNAME => array (CalendariovacunacionPeer::ID => 0, CalendariovacunacionPeer::NOMBRE => 1, CalendariovacunacionPeer::DESCRIPCION => 2, CalendariovacunacionPeer::PERIODO => 3, CalendariovacunacionPeer::OBSERVACION => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/CalendariovacunacionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.CalendariovacunacionMapBuilder'); + include_once 'lib/model/map/CalendariovacunacionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.CalendariovacunacionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CalendariovacunacionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(CalendariovacunacionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(calendariovacunacion.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT calendariovacunacion.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CalendariovacunacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CalendariovacunacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Calendariovacunacion - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return CalendariovacunacionPeer::populateObjects(CalendariovacunacionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ CalendariovacunacionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = CalendariovacunacionPeer::getOMClass(); + $cls = CalendariovacunacionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -311,41 +192,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return CalendariovacunacionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Calendariovacunacion or Criteria object. - * - * @param mixed $values Criteria or Calendariovacunacion object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -353,21 +212,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Calendariovacunacion object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(CalendariovacunacionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(CalendariovacunacionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -378,15 +231,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Calendariovacunacion or Criteria object. - * - * @param mixed $values Criteria or Calendariovacunacion object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -396,37 +241,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(CalendariovacunacionPeer::ID); $selectCriteria->add(CalendariovacunacionPeer::ID, $criteria->remove(CalendariovacunacionPeer::ID), $comparison); - } else { // $values is Calendariovacunacion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the calendariovacunacion table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(CalendariovacunacionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -436,17 +269,7 @@ } } - /** - * Method perform a DELETE on the database, given a Calendariovacunacion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Calendariovacunacion object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -454,25 +277,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Calendariovacunacion) { + $criteria = clone $values; } elseif ($values instanceof Calendariovacunacion) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(CalendariovacunacionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -483,18 +300,7 @@ } } - /** - * Validates all modified columns of given Calendariovacunacion object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Calendariovacunacion $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Calendariovacunacion $obj, $cols = null) { $columns = array(); @@ -529,13 +335,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Calendariovacunacion - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -552,14 +352,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -577,20 +370,14 @@ return $objs; } -} // BaseCalendariovacunacionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseCalendariovacunacionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/CalendariovacunacionMapBuilder.php'; - Propel::registerMapBuilder('model.map.CalendariovacunacionMapBuilder'); + require_once 'lib/model/map/CalendariovacunacionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.CalendariovacunacionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCargobaja.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCargobaja.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCargobaja.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/CargobajaPeer.php'; - -/** - * Base class that represents a row from the 'cargobaja' table. - * - * - * - * @package model.om - */ abstract class BaseCargobaja extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var CargobajaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * Collection to store aggregation of collRelDivisionActividadDocentes. - * @var array - */ + protected $collRelDivisionActividadDocentes; - /** - * The criteria used to select the current contents of collRelDivisionActividadDocentes. - * @var Criteria - */ + protected $lastRelDivisionActividadDocenteCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = CargobajaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = CargobajaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = CargobajaPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = CargobajaPeer::NUM_COLUMNS - CargobajaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Cargobaja object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = CargobajaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += CargobajaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelDivisionActividadDocentes !== null) { foreach($this->collRelDivisionActividadDocentes as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = CargobajaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = CargobajaPeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = CargobajaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CargobajaPeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(CargobajaPeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(CargobajaPeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Cargobaja (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelDivisionActividadDocentes() as $relObj) { $copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Cargobaja Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CargobajaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collRelDivisionActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDivisionActividadDocentes() { if ($this->collRelDivisionActividadDocentes === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cargobaja has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * If this Cargobaja is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDivisionActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, $this->getId()); RelDivisionActividadDocentePeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Returns the number of related RelDivisionActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDivisionActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return RelDivisionActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDivisionActividadDocente object to this object - * through the RelDivisionActividadDocente foreign key attribute - * - * @param RelDivisionActividadDocente $l RelDivisionActividadDocente - * @return void - * @throws PropelException - */ + public function addRelDivisionActividadDocente(RelDivisionActividadDocente $l) { $this->collRelDivisionActividadDocentes[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cargobaja is new, it will return - * an empty collection; or if this Cargobaja has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cargobaja. - */ + public function getRelDivisionActividadDocentesJoinDivision($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDivision($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -788,21 +479,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cargobaja is new, it will return - * an empty collection; or if this Cargobaja has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cargobaja. - */ + public function getRelDivisionActividadDocentesJoinTipodocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -821,10 +501,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinTipodocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -837,21 +514,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cargobaja is new, it will return - * an empty collection; or if this Cargobaja has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cargobaja. - */ + public function getRelDivisionActividadDocentesJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -870,10 +536,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -886,21 +549,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cargobaja is new, it will return - * an empty collection; or if this Cargobaja has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cargobaja. - */ + public function getRelDivisionActividadDocentesJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -919,10 +571,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -935,21 +584,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cargobaja is new, it will return - * an empty collection; or if this Cargobaja has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cargobaja. - */ + public function getRelDivisionActividadDocentesJoinRepeticion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -968,10 +606,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinRepeticion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -983,4 +618,4 @@ return $this->collRelDivisionActividadDocentes; } -} // BaseCargobaja +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCargobajaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCargobajaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCargobajaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by CargobajaPeer::getOMClass() -include_once 'model/Cargobaja.php'; -/** - * Base static class for performing query and update operations on the 'cargobaja' table. - * - * - * - * @package model.om - */ abstract class BaseCargobajaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'cargobaja'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Cargobaja'; + + const CLASS_DEFAULT = 'lib.model.Cargobaja'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'cargobaja.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'cargobaja.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'cargobaja.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (CargobajaPeer::ID, CargobajaPeer::NOMBRE, CargobajaPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (CargobajaPeer::ID => 0, CargobajaPeer::NOMBRE => 1, CargobajaPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/CargobajaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.CargobajaMapBuilder'); + include_once 'lib/model/map/CargobajaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.CargobajaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CargobajaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(CargobajaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(cargobaja.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT cargobaja.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CargobajaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CargobajaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Cargobaja - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return CargobajaPeer::populateObjects(CargobajaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ CargobajaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = CargobajaPeer::getOMClass(); + $cls = CargobajaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return CargobajaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Cargobaja or Criteria object. - * - * @param mixed $values Criteria or Cargobaja object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Cargobaja object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(CargobajaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(CargobajaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Cargobaja or Criteria object. - * - * @param mixed $values Criteria or Cargobaja object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(CargobajaPeer::ID); $selectCriteria->add(CargobajaPeer::ID, $criteria->remove(CargobajaPeer::ID), $comparison); - } else { // $values is Cargobaja object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the cargobaja table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(CargobajaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Cargobaja or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Cargobaja object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Cargobaja) { + $criteria = clone $values; } elseif ($values instanceof Cargobaja) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(CargobajaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Cargobaja object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Cargobaja $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Cargobaja $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Cargobaja - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseCargobajaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseCargobajaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/CargobajaMapBuilder.php'; - Propel::registerMapBuilder('model.map.CargobajaMapBuilder'); + require_once 'lib/model/map/CargobajaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.CargobajaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,169 +1,86 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/CiclolectivoPeer.php'; - -/** - * Base class that represents a row from the 'ciclolectivo' table. - * - * - * - * @package model.om - */ abstract class BaseCiclolectivo extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var CiclolectivoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id; - /** - * The value for the fecha_inicio field. - * @var int - */ + protected $fecha_inicio; - /** - * The value for the fecha_fin field. - * @var int - */ + protected $fecha_fin; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * The value for the actual field. - * @var boolean - */ + protected $actual = true; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Collection to store aggregation of collTurnoss. - * @var array - */ + protected $collTurnoss; - /** - * The criteria used to select the current contents of collTurnoss. - * @var Criteria - */ + protected $lastTurnosCriteria = null; - /** - * Collection to store aggregation of collPeriodos. - * @var array - */ + protected $collPeriodos; - /** - * The criteria used to select the current contents of collPeriodos. - * @var Criteria - */ + protected $lastPeriodoCriteria = null; - /** - * Collection to store aggregation of collFeriados. - * @var array - */ + protected $collFeriados; - /** - * The criteria used to select the current contents of collFeriados. - * @var Criteria - */ + protected $lastFeriadoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [optionally formatted] [fecha_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaInicio($format = 'Y-m-d H:i:s') { if ($this->fecha_inicio === null || $this->fecha_inicio === '') { return null; } elseif (!is_int($this->fecha_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); + $ts = strtotime($this->fecha_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); } } else { $ts = $this->fecha_inicio; @@ -177,24 +94,15 @@ } } - /** - * Get the [optionally formatted] [fecha_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaFin($format = 'Y-m-d H:i:s') { if ($this->fecha_fin === null || $this->fecha_fin === '') { return null; } elseif (!is_int($this->fecha_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); + $ts = strtotime($this->fecha_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); } } else { $ts = $this->fecha_fin; @@ -208,34 +116,21 @@ } } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [actual] column value. - * - * @return boolean - */ + public function getActual() { return $this->actual; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -244,14 +139,8 @@ $this->modifiedColumns[] = CiclolectivoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -264,21 +153,14 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [fecha_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -288,21 +170,14 @@ $this->modifiedColumns[] = CiclolectivoPeer::FECHA_INICIO; } - } // setFechaInicio() - - /** - * Set the value of [fecha_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -312,14 +187,8 @@ $this->modifiedColumns[] = CiclolectivoPeer::FECHA_FIN; } - } // setFechaFin() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -328,14 +197,8 @@ $this->modifiedColumns[] = CiclolectivoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [actual] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActual($v) { @@ -344,21 +207,8 @@ $this->modifiedColumns[] = CiclolectivoPeer::ACTUAL; } - } // setActual() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -379,23 +229,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = CiclolectivoPeer::NUM_COLUMNS - CiclolectivoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating Ciclolectivo object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -417,16 +257,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -448,29 +279,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -479,22 +295,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = CiclolectivoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += CiclolectivoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collTurnoss !== null) { foreach($this->collTurnoss as $referrerFK) { @@ -523,37 +333,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -566,16 +356,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -585,11 +366,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -633,28 +410,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = CiclolectivoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -679,19 +442,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = CiclolectivoPeer::getFieldNames($keyType); @@ -706,30 +459,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = CiclolectivoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -751,25 +488,9 @@ case 5: $this->setActual($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CiclolectivoPeer::getFieldNames($keyType); @@ -782,11 +503,7 @@ if (array_key_exists($keys[5], $arr)) $this->setActual($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(CiclolectivoPeer::DATABASE_NAME); @@ -801,14 +518,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(CiclolectivoPeer::DATABASE_NAME); @@ -818,36 +528,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Ciclolectivo (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -863,9 +556,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getTurnoss() as $relObj) { $copyObj->addTurnos($relObj->copy($deepCopy)); @@ -879,45 +570,23 @@ $copyObj->addFeriado($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Ciclolectivo Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CiclolectivoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -926,13 +595,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -948,41 +611,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Temporary storage of collTurnoss to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initTurnoss() { if ($this->collTurnoss === null) { @@ -990,23 +633,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Ciclolectivo has previously - * been saved, it will retrieve related Turnoss from storage. - * If this Ciclolectivo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getTurnoss($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseTurnosPeer.php'; + include_once 'lib/model/om/BaseTurnosPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1026,13 +656,9 @@ $this->collTurnoss = TurnosPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(TurnosPeer::FK_CICLOLECTIVO_ID, $this->getId()); TurnosPeer::addSelectColumns($criteria); @@ -1045,18 +671,10 @@ return $this->collTurnoss; } - /** - * Returns the number of related Turnoss. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countTurnoss($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseTurnosPeer.php'; + include_once 'lib/model/om/BaseTurnosPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1070,26 +688,14 @@ return TurnosPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Turnos object to this object - * through the Turnos foreign key attribute - * - * @param Turnos $l Turnos - * @return void - * @throws PropelException - */ + public function addTurnos(Turnos $l) { $this->collTurnoss[] = $l; $l->setCiclolectivo($this); } - /** - * Temporary storage of collPeriodos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initPeriodos() { if ($this->collPeriodos === null) { @@ -1097,23 +703,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Ciclolectivo has previously - * been saved, it will retrieve related Periodos from storage. - * If this Ciclolectivo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getPeriodos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BasePeriodoPeer.php'; + include_once 'lib/model/om/BasePeriodoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1133,13 +726,9 @@ $this->collPeriodos = PeriodoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $this->getId()); PeriodoPeer::addSelectColumns($criteria); @@ -1152,18 +741,10 @@ return $this->collPeriodos; } - /** - * Returns the number of related Periodos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countPeriodos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BasePeriodoPeer.php'; + include_once 'lib/model/om/BasePeriodoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1177,26 +758,14 @@ return PeriodoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Periodo object to this object - * through the Periodo foreign key attribute - * - * @param Periodo $l Periodo - * @return void - * @throws PropelException - */ + public function addPeriodo(Periodo $l) { $this->collPeriodos[] = $l; $l->setCiclolectivo($this); } - /** - * Temporary storage of collFeriados to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initFeriados() { if ($this->collFeriados === null) { @@ -1204,23 +773,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Ciclolectivo has previously - * been saved, it will retrieve related Feriados from storage. - * If this Ciclolectivo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getFeriados($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseFeriadoPeer.php'; + include_once 'lib/model/om/BaseFeriadoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1240,13 +796,9 @@ $this->collFeriados = FeriadoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(FeriadoPeer::FK_CICLOLECTIVO_ID, $this->getId()); FeriadoPeer::addSelectColumns($criteria); @@ -1259,18 +811,10 @@ return $this->collFeriados; } - /** - * Returns the number of related Feriados. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countFeriados($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseFeriadoPeer.php'; + include_once 'lib/model/om/BaseFeriadoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1284,18 +828,11 @@ return FeriadoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Feriado object to this object - * through the Feriado foreign key attribute - * - * @param Feriado $l Feriado - * @return void - * @throws PropelException - */ + public function addFeriado(Feriado $l) { $this->collFeriados[] = $l; $l->setCiclolectivo($this); } -} // BaseCiclolectivo +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCiclolectivoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by CiclolectivoPeer::getOMClass() -include_once 'model/Ciclolectivo.php'; -/** - * Base static class for performing query and update operations on the 'ciclolectivo' table. - * - * - * - * @package model.om - */ abstract class BaseCiclolectivoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'ciclolectivo'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Ciclolectivo'; + + const CLASS_DEFAULT = 'lib.model.Ciclolectivo'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'ciclolectivo.ID'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'ciclolectivo.FK_ESTABLECIMIENTO_ID'; - /** the column name for the FECHA_INICIO field */ + const FECHA_INICIO = 'ciclolectivo.FECHA_INICIO'; - /** the column name for the FECHA_FIN field */ + const FECHA_FIN = 'ciclolectivo.FECHA_FIN'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'ciclolectivo.DESCRIPCION'; - /** the column name for the ACTUAL field */ + const ACTUAL = 'ciclolectivo.ACTUAL'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEstablecimientoId', 'FechaInicio', 'FechaFin', 'Descripcion', 'Actual', ), BasePeer::TYPE_COLNAME => array (CiclolectivoPeer::ID, CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, CiclolectivoPeer::FECHA_INICIO, CiclolectivoPeer::FECHA_FIN, CiclolectivoPeer::DESCRIPCION, CiclolectivoPeer::ACTUAL, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEstablecimientoId' => 1, 'FechaInicio' => 2, 'FechaFin' => 3, 'Descripcion' => 4, 'Actual' => 5, ), BasePeer::TYPE_COLNAME => array (CiclolectivoPeer::ID => 0, CiclolectivoPeer::FK_ESTABLECIMIENTO_ID => 1, CiclolectivoPeer::FECHA_INICIO => 2, CiclolectivoPeer::FECHA_FIN => 3, CiclolectivoPeer::DESCRIPCION => 4, CiclolectivoPeer::ACTUAL => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/CiclolectivoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.CiclolectivoMapBuilder'); + include_once 'lib/model/map/CiclolectivoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.CiclolectivoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CiclolectivoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(CiclolectivoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(ciclolectivo.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT ciclolectivo.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CiclolectivoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CiclolectivoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Ciclolectivo - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return CiclolectivoPeer::populateObjects(CiclolectivoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ CiclolectivoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = CiclolectivoPeer::getOMClass(); + $cls = CiclolectivoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -317,29 +198,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CiclolectivoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CiclolectivoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -350,25 +221,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Ciclolectivo objects pre-filled with their Establecimiento objects. - * - * @return array Array of Ciclolectivo objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -396,46 +259,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addCiclolectivo($obj1); //CHECKME - break; + $temp_obj2->addCiclolectivo($obj1); break; } } if ($newObject) { $obj2->initCiclolectivos(); - $obj2->addCiclolectivo($obj1); //CHECKME - } + $obj2->addCiclolectivo($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CiclolectivoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CiclolectivoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -446,25 +296,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Ciclolectivo objects pre-filled with all related objects. - * - * @return array Array of Ciclolectivo objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -489,8 +331,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -501,11 +342,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addCiclolectivo($obj1); // CHECKME - break; + $temp_obj2->addCiclolectivo($obj1); break; } } @@ -519,41 +358,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return CiclolectivoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Ciclolectivo or Criteria object. - * - * @param mixed $values Criteria or Ciclolectivo object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -561,21 +378,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Ciclolectivo object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(CiclolectivoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(CiclolectivoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -586,15 +397,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Ciclolectivo or Criteria object. - * - * @param mixed $values Criteria or Ciclolectivo object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -604,37 +407,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(CiclolectivoPeer::ID); $selectCriteria->add(CiclolectivoPeer::ID, $criteria->remove(CiclolectivoPeer::ID), $comparison); - } else { // $values is Ciclolectivo object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the ciclolectivo table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(CiclolectivoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -644,17 +435,7 @@ } } - /** - * Method perform a DELETE on the database, given a Ciclolectivo or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Ciclolectivo object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -662,25 +443,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Ciclolectivo) { + $criteria = clone $values; } elseif ($values instanceof Ciclolectivo) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(CiclolectivoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -691,18 +466,7 @@ } } - /** - * Validates all modified columns of given Ciclolectivo object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Ciclolectivo $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Ciclolectivo $obj, $cols = null) { $columns = array(); @@ -737,13 +501,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Ciclolectivo - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -760,14 +518,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -785,20 +536,14 @@ return $objs; } -} // BaseCiclolectivoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseCiclolectivoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/CiclolectivoMapBuilder.php'; - Propel::registerMapBuilder('model.map.CiclolectivoMapBuilder'); + require_once 'lib/model/map/CiclolectivoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.CiclolectivoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseConcepto.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseConcepto.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseConcepto.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,141 +1,72 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ConceptoPeer.php'; - -/** - * Base class that represents a row from the 'concepto' table. - * - * - * - * @package model.om - */ abstract class BaseConcepto extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ConceptoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Collection to store aggregation of collBoletinConceptuals. - * @var array - */ + protected $collBoletinConceptuals; - /** - * The criteria used to select the current contents of collBoletinConceptuals. - * @var Criteria - */ + protected $lastBoletinConceptualCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -144,14 +75,8 @@ $this->modifiedColumns[] = ConceptoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -164,14 +89,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -180,14 +99,8 @@ $this->modifiedColumns[] = ConceptoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -196,21 +109,8 @@ $this->modifiedColumns[] = ConceptoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -227,23 +127,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = ConceptoPeer::NUM_COLUMNS - ConceptoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Concepto object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -265,16 +155,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -296,29 +177,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -327,22 +193,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ConceptoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ConceptoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collBoletinConceptuals !== null) { foreach($this->collBoletinConceptuals as $referrerFK) { @@ -355,37 +215,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -398,16 +238,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -417,11 +248,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -449,28 +276,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ConceptoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -489,19 +302,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ConceptoPeer::getFieldNames($keyType); @@ -514,30 +317,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ConceptoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -553,25 +340,9 @@ case 3: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ConceptoPeer::getFieldNames($keyType); @@ -582,11 +353,7 @@ if (array_key_exists($keys[3], $arr)) $this->setDescripcion($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ConceptoPeer::DATABASE_NAME); @@ -599,14 +366,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ConceptoPeer::DATABASE_NAME); @@ -616,36 +376,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Concepto (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -657,53 +400,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getBoletinConceptuals() as $relObj) { $copyObj->addBoletinConceptual($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Concepto Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ConceptoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -712,13 +431,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -734,41 +447,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Temporary storage of collBoletinConceptuals to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinConceptuals() { if ($this->collBoletinConceptuals === null) { @@ -776,23 +469,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Concepto has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * If this Concepto is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinConceptuals($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -812,13 +492,9 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinConceptualPeer::FK_CONCEPTO_ID, $this->getId()); BoletinConceptualPeer::addSelectColumns($criteria); @@ -831,18 +507,10 @@ return $this->collBoletinConceptuals; } - /** - * Returns the number of related BoletinConceptuals. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinConceptuals($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -856,14 +524,7 @@ return BoletinConceptualPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinConceptual object to this object - * through the BoletinConceptual foreign key attribute - * - * @param BoletinConceptual $l BoletinConceptual - * @return void - * @throws PropelException - */ + public function addBoletinConceptual(BoletinConceptual $l) { $this->collBoletinConceptuals[] = $l; @@ -871,21 +532,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Concepto is new, it will return - * an empty collection; or if this Concepto has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Concepto. - */ + public function getBoletinConceptualsJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -904,10 +554,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_CONCEPTO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -920,21 +567,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Concepto is new, it will return - * an empty collection; or if this Concepto has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Concepto. - */ + public function getBoletinConceptualsJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -953,10 +589,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_CONCEPTO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -969,21 +602,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Concepto is new, it will return - * an empty collection; or if this Concepto has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Concepto. - */ + public function getBoletinConceptualsJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1002,10 +624,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_CONCEPTO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1017,4 +636,4 @@ return $this->collBoletinConceptuals; } -} // BaseConcepto +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseConceptoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseConceptoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseConceptoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ConceptoPeer::getOMClass() -include_once 'model/Concepto.php'; -/** - * Base static class for performing query and update operations on the 'concepto' table. - * - * - * - * @package model.om - */ abstract class BaseConceptoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'concepto'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Concepto'; + + const CLASS_DEFAULT = 'lib.model.Concepto'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'concepto.ID'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'concepto.FK_ESTABLECIMIENTO_ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'concepto.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'concepto.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEstablecimientoId', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (ConceptoPeer::ID, ConceptoPeer::FK_ESTABLECIMIENTO_ID, ConceptoPeer::NOMBRE, ConceptoPeer::DESCRIPCION, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEstablecimientoId' => 1, 'Nombre' => 2, 'Descripcion' => 3, ), BasePeer::TYPE_COLNAME => array (ConceptoPeer::ID => 0, ConceptoPeer::FK_ESTABLECIMIENTO_ID => 1, ConceptoPeer::NOMBRE => 2, ConceptoPeer::DESCRIPCION => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ConceptoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ConceptoMapBuilder'); + include_once 'lib/model/map/ConceptoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ConceptoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ConceptoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ConceptoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(concepto.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT concepto.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ConceptoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ConceptoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Concepto - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ConceptoPeer::populateObjects(ConceptoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ ConceptoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ConceptoPeer::getOMClass(); + $cls = ConceptoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -307,29 +188,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ConceptoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ConceptoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -340,25 +211,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Concepto objects pre-filled with their Establecimiento objects. - * - * @return array Array of Concepto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -386,46 +249,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addConcepto($obj1); //CHECKME - break; + $temp_obj2->addConcepto($obj1); break; } } if ($newObject) { $obj2->initConceptos(); - $obj2->addConcepto($obj1); //CHECKME - } + $obj2->addConcepto($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ConceptoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ConceptoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -436,25 +286,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Concepto objects pre-filled with all related objects. - * - * @return array Array of Concepto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -479,8 +321,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -491,11 +332,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addConcepto($obj1); // CHECKME - break; + $temp_obj2->addConcepto($obj1); break; } } @@ -509,41 +348,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ConceptoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Concepto or Criteria object. - * - * @param mixed $values Criteria or Concepto object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -551,21 +368,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Concepto object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ConceptoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ConceptoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -576,15 +387,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Concepto or Criteria object. - * - * @param mixed $values Criteria or Concepto object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -594,37 +397,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ConceptoPeer::ID); $selectCriteria->add(ConceptoPeer::ID, $criteria->remove(ConceptoPeer::ID), $comparison); - } else { // $values is Concepto object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the concepto table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ConceptoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -634,17 +425,7 @@ } } - /** - * Method perform a DELETE on the database, given a Concepto or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Concepto object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -652,25 +433,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Concepto) { + $criteria = clone $values; } elseif ($values instanceof Concepto) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ConceptoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -681,18 +456,7 @@ } } - /** - * Validates all modified columns of given Concepto object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Concepto $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Concepto $obj, $cols = null) { $columns = array(); @@ -727,13 +491,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Concepto - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -750,14 +508,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -775,20 +526,14 @@ return $objs; } -} // BaseConceptoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseConceptoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ConceptoMapBuilder.php'; - Propel::registerMapBuilder('model.map.ConceptoMapBuilder'); + require_once 'lib/model/map/ConceptoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ConceptoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseConceptobaja.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseConceptobaja.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseConceptobaja.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ConceptobajaPeer.php'; - -/** - * Base class that represents a row from the 'conceptobaja' table. - * - * - * - * @package model.om - */ abstract class BaseConceptobaja extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ConceptobajaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * Collection to store aggregation of collAlumnos. - * @var array - */ + protected $collAlumnos; - /** - * The criteria used to select the current contents of collAlumnos. - * @var Criteria - */ + protected $lastAlumnoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = ConceptobajaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = ConceptobajaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = ConceptobajaPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = ConceptobajaPeer::NUM_COLUMNS - ConceptobajaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Conceptobaja object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ConceptobajaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ConceptobajaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collAlumnos !== null) { foreach($this->collAlumnos as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ConceptobajaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ConceptobajaPeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ConceptobajaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ConceptobajaPeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ConceptobajaPeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ConceptobajaPeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Conceptobaja (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getAlumnos() as $relObj) { $copyObj->addAlumno($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Conceptobaja Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ConceptobajaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAlumnos() { if ($this->collAlumnos === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Conceptobaja has previously - * been saved, it will retrieve related Alumnos from storage. - * If this Conceptobaja is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collAlumnos = AlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AlumnoPeer::FK_CONCEPTOBAJA_ID, $this->getId()); AlumnoPeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collAlumnos; } - /** - * Returns the number of related Alumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return AlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Alumno object to this object - * through the Alumno foreign key attribute - * - * @param Alumno $l Alumno - * @return void - * @throws PropelException - */ + public function addAlumno(Alumno $l) { $this->collAlumnos[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Conceptobaja is new, it will return - * an empty collection; or if this Conceptobaja has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Conceptobaja. - */ + public function getAlumnosJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CONCEPTOBAJA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -788,21 +479,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Conceptobaja is new, it will return - * an empty collection; or if this Conceptobaja has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Conceptobaja. - */ + public function getAlumnosJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -821,10 +501,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CONCEPTOBAJA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -837,21 +514,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Conceptobaja is new, it will return - * an empty collection; or if this Conceptobaja has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Conceptobaja. - */ + public function getAlumnosJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -870,10 +536,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CONCEPTOBAJA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -886,21 +549,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Conceptobaja is new, it will return - * an empty collection; or if this Conceptobaja has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Conceptobaja. - */ + public function getAlumnosJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -919,10 +571,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CONCEPTOBAJA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -935,21 +584,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Conceptobaja is new, it will return - * an empty collection; or if this Conceptobaja has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Conceptobaja. - */ + public function getAlumnosJoinPais($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -968,10 +606,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinPais($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CONCEPTOBAJA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -983,4 +618,4 @@ return $this->collAlumnos; } -} // BaseConceptobaja +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseConceptobajaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseConceptobajaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseConceptobajaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ConceptobajaPeer::getOMClass() -include_once 'model/Conceptobaja.php'; -/** - * Base static class for performing query and update operations on the 'conceptobaja' table. - * - * - * - * @package model.om - */ abstract class BaseConceptobajaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'conceptobaja'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Conceptobaja'; + + const CLASS_DEFAULT = 'lib.model.Conceptobaja'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'conceptobaja.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'conceptobaja.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'conceptobaja.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (ConceptobajaPeer::ID, ConceptobajaPeer::NOMBRE, ConceptobajaPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (ConceptobajaPeer::ID => 0, ConceptobajaPeer::NOMBRE => 1, ConceptobajaPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ConceptobajaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ConceptobajaMapBuilder'); + include_once 'lib/model/map/ConceptobajaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ConceptobajaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ConceptobajaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ConceptobajaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(conceptobaja.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT conceptobaja.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ConceptobajaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ConceptobajaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Conceptobaja - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ConceptobajaPeer::populateObjects(ConceptobajaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ ConceptobajaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ConceptobajaPeer::getOMClass(); + $cls = ConceptobajaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ConceptobajaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Conceptobaja or Criteria object. - * - * @param mixed $values Criteria or Conceptobaja object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Conceptobaja object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ConceptobajaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ConceptobajaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Conceptobaja or Criteria object. - * - * @param mixed $values Criteria or Conceptobaja object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ConceptobajaPeer::ID); $selectCriteria->add(ConceptobajaPeer::ID, $criteria->remove(ConceptobajaPeer::ID), $comparison); - } else { // $values is Conceptobaja object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the conceptobaja table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ConceptobajaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Conceptobaja or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Conceptobaja object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Conceptobaja) { + $criteria = clone $values; } elseif ($values instanceof Conceptobaja) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ConceptobajaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Conceptobaja object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Conceptobaja $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Conceptobaja $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Conceptobaja - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseConceptobajaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseConceptobajaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ConceptobajaMapBuilder.php'; - Propel::registerMapBuilder('model.map.ConceptobajaMapBuilder'); + require_once 'lib/model/map/ConceptobajaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ConceptobajaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCuenta.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCuenta.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCuenta.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,266 +1,147 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/CuentaPeer.php'; - -/** - * Base class that represents a row from the 'cuenta' table. - * - * - * - * @package model.om - */ abstract class BaseCuenta extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var CuentaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the razon_social field. - * @var string - */ + protected $razon_social = ''; - /** - * The value for the cuit field. - * @var string - */ + protected $cuit = ''; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion = ''; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad = ''; - /** - * The value for the codigo_postal field. - * @var string - */ + protected $codigo_postal = ''; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono = ''; - /** - * The value for the fk_provincia_id field. - * @var int - */ + protected $fk_provincia_id = 0; - /** - * The value for the fk_tipoiva_id field. - * @var int - */ + protected $fk_tipoiva_id = 0; - /** - * @var Tipoiva - */ + protected $aTipoiva; - /** - * @var Provincia - */ + protected $aProvincia; - /** - * Collection to store aggregation of collAlumnos. - * @var array - */ + protected $collAlumnos; - /** - * The criteria used to select the current contents of collAlumnos. - * @var Criteria - */ + protected $lastAlumnoCriteria = null; - /** - * Collection to store aggregation of collResponsables. - * @var array - */ + protected $collResponsables; - /** - * The criteria used to select the current contents of collResponsables. - * @var Criteria - */ + protected $lastResponsableCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [razon_social] column value. - * - * @return string - */ + public function getRazonSocial() { return $this->razon_social; } - /** - * Get the [cuit] column value. - * - * @return string - */ + public function getCuit() { return $this->cuit; } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Get the [codigo_postal] column value. - * - * @return string - */ + public function getCodigoPostal() { return $this->codigo_postal; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [fk_provincia_id] column value. - * - * @return int - */ + public function getFkProvinciaId() { return $this->fk_provincia_id; } - /** - * Get the [fk_tipoiva_id] column value. - * - * @return int - */ + public function getFkTipoivaId() { return $this->fk_tipoiva_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -269,14 +150,8 @@ $this->modifiedColumns[] = CuentaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -285,14 +160,8 @@ $this->modifiedColumns[] = CuentaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [razon_social] column. - * - * @param string $v new value - * @return void - */ + } + public function setRazonSocial($v) { @@ -301,14 +170,8 @@ $this->modifiedColumns[] = CuentaPeer::RAZON_SOCIAL; } - } // setRazonSocial() - - /** - * Set the value of [cuit] column. - * - * @param string $v new value - * @return void - */ + } + public function setCuit($v) { @@ -317,14 +180,8 @@ $this->modifiedColumns[] = CuentaPeer::CUIT; } - } // setCuit() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -333,14 +190,8 @@ $this->modifiedColumns[] = CuentaPeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -349,14 +200,8 @@ $this->modifiedColumns[] = CuentaPeer::CIUDAD; } - } // setCiudad() - - /** - * Set the value of [codigo_postal] column. - * - * @param string $v new value - * @return void - */ + } + public function setCodigoPostal($v) { @@ -365,14 +210,8 @@ $this->modifiedColumns[] = CuentaPeer::CODIGO_POSTAL; } - } // setCodigoPostal() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -381,14 +220,8 @@ $this->modifiedColumns[] = CuentaPeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [fk_provincia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkProvinciaId($v) { @@ -401,14 +234,8 @@ $this->aProvincia = null; } - } // setFkProvinciaId() - - /** - * Set the value of [fk_tipoiva_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipoivaId($v) { @@ -421,21 +248,8 @@ $this->aTipoiva = null; } - } // setFkTipoivaId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -464,23 +278,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 10; // 10 = CuentaPeer::NUM_COLUMNS - CuentaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 10; } catch (Exception $e) { throw new PropelException("Error populating Cuenta object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -502,16 +306,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -533,29 +328,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipoiva !== null) { if ($this->aTipoiva->isModified()) { $affectedRows += $this->aTipoiva->save($con); @@ -571,22 +351,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = CuentaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += CuentaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collAlumnos !== null) { foreach($this->collAlumnos as $referrerFK) { @@ -607,37 +381,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -650,16 +404,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -669,11 +414,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipoiva !== null) { if (!$this->aTipoiva->validate($columns)) { $failureMap = array_merge($failureMap, $this->aTipoiva->getValidationFailures()); @@ -715,28 +456,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = CuentaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -773,19 +500,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = CuentaPeer::getFieldNames($keyType); @@ -804,30 +521,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = CuentaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -861,25 +562,9 @@ case 9: $this->setFkTipoivaId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CuentaPeer::getFieldNames($keyType); @@ -896,11 +581,7 @@ if (array_key_exists($keys[9], $arr)) $this->setFkTipoivaId($arr[$keys[9]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(CuentaPeer::DATABASE_NAME); @@ -919,14 +600,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(CuentaPeer::DATABASE_NAME); @@ -936,36 +610,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Cuenta (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -989,9 +646,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getAlumnos() as $relObj) { $copyObj->addAlumno($relObj->copy($deepCopy)); @@ -1001,45 +656,23 @@ $copyObj->addResponsable($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Cuenta Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CuentaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1048,13 +681,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Tipoiva object. - * - * @param Tipoiva $v - * @return void - * @throws PropelException - */ + public function setTipoiva($v) { @@ -1070,42 +697,21 @@ } - /** - * Get the associated Tipoiva object - * - * @param Connection Optional Connection object. - * @return Tipoiva The associated Tipoiva object. - * @throws PropelException - */ + public function getTipoiva($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipoivaPeer.php'; + include_once 'lib/model/om/BaseTipoivaPeer.php'; if ($this->aTipoiva === null && ($this->fk_tipoiva_id !== null)) { $this->aTipoiva = TipoivaPeer::retrieveByPK($this->fk_tipoiva_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipoivaPeer::retrieveByPK($this->fk_tipoiva_id, $con); - $obj->addTipoivas($this); - */ + } return $this->aTipoiva; } - /** - * Declares an association between this object and a Provincia object. - * - * @param Provincia $v - * @return void - * @throws PropelException - */ + public function setProvincia($v) { @@ -1121,41 +727,21 @@ } - /** - * Get the associated Provincia object - * - * @param Connection Optional Connection object. - * @return Provincia The associated Provincia object. - * @throws PropelException - */ + public function getProvincia($con = null) { - // include the related Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($this->aProvincia === null && ($this->fk_provincia_id !== null)) { $this->aProvincia = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - $obj->addProvincias($this); - */ + } return $this->aProvincia; } - /** - * Temporary storage of collAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAlumnos() { if ($this->collAlumnos === null) { @@ -1163,23 +749,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta has previously - * been saved, it will retrieve related Alumnos from storage. - * If this Cuenta is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1199,13 +772,9 @@ $this->collAlumnos = AlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getId()); AlumnoPeer::addSelectColumns($criteria); @@ -1218,18 +787,10 @@ return $this->collAlumnos; } - /** - * Returns the number of related Alumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1243,14 +804,7 @@ return AlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Alumno object to this object - * through the Alumno foreign key attribute - * - * @param Alumno $l Alumno - * @return void - * @throws PropelException - */ + public function addAlumno(Alumno $l) { $this->collAlumnos[] = $l; @@ -1258,21 +812,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getAlumnosJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1291,10 +834,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1307,21 +847,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getAlumnosJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1340,10 +869,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1356,21 +882,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getAlumnosJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1389,10 +904,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1405,21 +917,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getAlumnosJoinConceptobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1438,10 +939,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinConceptobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1454,21 +952,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getAlumnosJoinPais($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1487,10 +974,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinPais($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1502,12 +986,7 @@ return $this->collAlumnos; } - /** - * Temporary storage of collResponsables to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initResponsables() { if ($this->collResponsables === null) { @@ -1515,23 +994,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta has previously - * been saved, it will retrieve related Responsables from storage. - * If this Cuenta is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getResponsables($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1551,13 +1017,9 @@ $this->collResponsables = ResponsablePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ResponsablePeer::FK_CUENTA_ID, $this->getId()); ResponsablePeer::addSelectColumns($criteria); @@ -1570,18 +1032,10 @@ return $this->collResponsables; } - /** - * Returns the number of related Responsables. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countResponsables($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1595,14 +1049,7 @@ return ResponsablePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Responsable object to this object - * through the Responsable foreign key attribute - * - * @param Responsable $l Responsable - * @return void - * @throws PropelException - */ + public function addResponsable(Responsable $l) { $this->collResponsables[] = $l; @@ -1610,21 +1057,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Responsables from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getResponsablesJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1643,10 +1079,7 @@ $this->collResponsables = ResponsablePeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ResponsablePeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastResponsableCriteria) || !$this->lastResponsableCriteria->equals($criteria)) { @@ -1659,21 +1092,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Cuenta is new, it will return - * an empty collection; or if this Cuenta has previously - * been saved, it will retrieve related Responsables from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Cuenta. - */ + public function getResponsablesJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1692,10 +1114,7 @@ $this->collResponsables = ResponsablePeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ResponsablePeer::FK_CUENTA_ID, $this->getId()); if (!isset($this->lastResponsableCriteria) || !$this->lastResponsableCriteria->equals($criteria)) { @@ -1707,4 +1126,4 @@ return $this->collResponsables; } -} // BaseCuenta +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseCuentaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseCuentaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseCuentaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,75 +1,59 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by CuentaPeer::getOMClass() -include_once 'model/Cuenta.php'; -/** - * Base static class for performing query and update operations on the 'cuenta' table. - * - * - * - * @package model.om - */ abstract class BaseCuentaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'cuenta'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Cuenta'; + + const CLASS_DEFAULT = 'lib.model.Cuenta'; - /** The total number of columns. */ + const NUM_COLUMNS = 10; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'cuenta.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'cuenta.NOMBRE'; - /** the column name for the RAZON_SOCIAL field */ + const RAZON_SOCIAL = 'cuenta.RAZON_SOCIAL'; - /** the column name for the CUIT field */ + const CUIT = 'cuenta.CUIT'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'cuenta.DIRECCION'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'cuenta.CIUDAD'; - /** the column name for the CODIGO_POSTAL field */ + const CODIGO_POSTAL = 'cuenta.CODIGO_POSTAL'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'cuenta.TELEFONO'; - /** the column name for the FK_PROVINCIA_ID field */ + const FK_PROVINCIA_ID = 'cuenta.FK_PROVINCIA_ID'; - /** the column name for the FK_TIPOIVA_ID field */ + const FK_TIPOIVA_ID = 'cuenta.FK_TIPOIVA_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'RazonSocial', 'Cuit', 'Direccion', 'Ciudad', 'CodigoPostal', 'Telefono', 'FkProvinciaId', 'FkTipoivaId', ), BasePeer::TYPE_COLNAME => array (CuentaPeer::ID, CuentaPeer::NOMBRE, CuentaPeer::RAZON_SOCIAL, CuentaPeer::CUIT, CuentaPeer::DIRECCION, CuentaPeer::CIUDAD, CuentaPeer::CODIGO_POSTAL, CuentaPeer::TELEFONO, CuentaPeer::FK_PROVINCIA_ID, CuentaPeer::FK_TIPOIVA_ID, ), @@ -77,12 +61,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'RazonSocial' => 2, 'Cuit' => 3, 'Direccion' => 4, 'Ciudad' => 5, 'CodigoPostal' => 6, 'Telefono' => 7, 'FkProvinciaId' => 8, 'FkTipoivaId' => 9, ), BasePeer::TYPE_COLNAME => array (CuentaPeer::ID => 0, CuentaPeer::NOMBRE => 1, CuentaPeer::RAZON_SOCIAL => 2, CuentaPeer::CUIT => 3, CuentaPeer::DIRECCION => 4, CuentaPeer::CIUDAD => 5, CuentaPeer::CODIGO_POSTAL => 6, CuentaPeer::TELEFONO => 7, CuentaPeer::FK_PROVINCIA_ID => 8, CuentaPeer::FK_TIPOIVA_ID => 9, ), @@ -90,24 +69,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/CuentaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.CuentaMapBuilder'); + include_once 'lib/model/map/CuentaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.CuentaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -121,15 +89,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -140,14 +100,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -157,34 +110,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CuentaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(CuentaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -213,29 +145,19 @@ const COUNT = 'COUNT(cuenta.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT cuenta.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CuentaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CuentaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -244,19 +166,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Cuenta - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -267,33 +180,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return CuentaPeer::populateObjects(CuentaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -305,29 +197,18 @@ CuentaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = CuentaPeer::getOMClass(); + $cls = CuentaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -337,29 +218,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Tipoiva table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipoiva(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CuentaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CuentaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -370,35 +241,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CuentaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CuentaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -409,25 +269,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Cuenta objects pre-filled with their Tipoiva objects. - * - * @return array Array of Cuenta objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipoiva(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -455,37 +307,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipoiva(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoiva(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addCuenta($obj1); //CHECKME - break; + $temp_obj2->addCuenta($obj1); break; } } if ($newObject) { $obj2->initCuentas(); - $obj2->addCuenta($obj1); //CHECKME - } + $obj2->addCuenta($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Cuenta objects pre-filled with their Provincia objects. - * - * @return array Array of Cuenta objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -513,46 +354,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addCuenta($obj1); //CHECKME - break; + $temp_obj2->addCuenta($obj1); break; } } if ($newObject) { $obj2->initCuentas(); - $obj2->addCuenta($obj1); //CHECKME - } + $obj2->addCuenta($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CuentaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CuentaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -565,25 +393,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Cuenta objects pre-filled with all related objects. - * - * @return array Array of Cuenta objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -613,8 +433,7 @@ $obj1->hydrate($rs); - // Add objects for joined Tipoiva rows - + $omClass = TipoivaPeer::getOMClass(); @@ -625,11 +444,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoiva(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoiva(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addCuenta($obj1); // CHECKME - break; + $temp_obj2->addCuenta($obj1); break; } } @@ -639,8 +456,7 @@ } - // Add objects for joined Provincia rows - + $omClass = ProvinciaPeer::getOMClass(); @@ -651,11 +467,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getProvincia(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getProvincia(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addCuenta($obj1); // CHECKME - break; + $temp_obj3->addCuenta($obj1); break; } } @@ -670,29 +484,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Tipoiva table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipoiva(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CuentaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CuentaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -703,35 +507,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(CuentaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(CuentaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -742,27 +535,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Cuenta objects pre-filled with all related objects except Tipoiva. - * - * @return array Array of Cuenta objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipoiva(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -796,8 +579,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addCuenta($obj1); break; @@ -815,21 +597,12 @@ } - /** - * Selects a collection of Cuenta objects pre-filled with all related objects except Provincia. - * - * @return array Array of Cuenta objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -863,8 +636,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoiva(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoiva(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addCuenta($obj1); break; @@ -881,41 +653,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return CuentaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Cuenta or Criteria object. - * - * @param mixed $values Criteria or Cuenta object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -923,21 +673,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Cuenta object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(CuentaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(CuentaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -948,15 +692,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Cuenta or Criteria object. - * - * @param mixed $values Criteria or Cuenta object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -966,37 +702,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(CuentaPeer::ID); $selectCriteria->add(CuentaPeer::ID, $criteria->remove(CuentaPeer::ID), $comparison); - } else { // $values is Cuenta object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the cuenta table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(CuentaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1006,17 +730,7 @@ } } - /** - * Method perform a DELETE on the database, given a Cuenta or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Cuenta object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1024,25 +738,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Cuenta) { + $criteria = clone $values; } elseif ($values instanceof Cuenta) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(CuentaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1053,18 +761,7 @@ } } - /** - * Validates all modified columns of given Cuenta object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Cuenta $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Cuenta $obj, $cols = null) { $columns = array(); @@ -1099,13 +796,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Cuenta - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1122,14 +813,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1147,20 +831,14 @@ return $objs; } -} // BaseCuentaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseCuentaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/CuentaMapBuilder.php'; - Propel::registerMapBuilder('model.map.CuentaMapBuilder'); + require_once 'lib/model/map/CuentaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.CuentaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolar.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolar.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolar.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,154 +1,80 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/DistritoescolarPeer.php'; - -/** - * Base class that represents a row from the 'distritoescolar' table. - * - * - * - * @package model.om - */ abstract class BaseDistritoescolar extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var DistritoescolarPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad; - /** - * Collection to store aggregation of collEstablecimientos. - * @var array - */ + protected $collEstablecimientos; - /** - * The criteria used to select the current contents of collEstablecimientos. - * @var Criteria - */ + protected $lastEstablecimientoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -157,14 +83,8 @@ $this->modifiedColumns[] = DistritoescolarPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -173,14 +93,8 @@ $this->modifiedColumns[] = DistritoescolarPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -189,14 +103,8 @@ $this->modifiedColumns[] = DistritoescolarPeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -205,14 +113,8 @@ $this->modifiedColumns[] = DistritoescolarPeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -221,21 +123,8 @@ $this->modifiedColumns[] = DistritoescolarPeer::CIUDAD; } - } // setCiudad() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -254,23 +143,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = DistritoescolarPeer::NUM_COLUMNS - DistritoescolarPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Distritoescolar object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -292,16 +171,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -323,40 +193,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = DistritoescolarPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += DistritoescolarPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collEstablecimientos !== null) { foreach($this->collEstablecimientos as $referrerFK) { @@ -369,37 +222,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -412,16 +245,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -451,28 +275,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = DistritoescolarPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -494,19 +304,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = DistritoescolarPeer::getFieldNames($keyType); @@ -520,30 +320,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = DistritoescolarPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -562,25 +346,9 @@ case 4: $this->setCiudad($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = DistritoescolarPeer::getFieldNames($keyType); @@ -592,11 +360,7 @@ if (array_key_exists($keys[4], $arr)) $this->setCiudad($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(DistritoescolarPeer::DATABASE_NAME); @@ -610,14 +374,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(DistritoescolarPeer::DATABASE_NAME); @@ -627,36 +384,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Distritoescolar (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -670,53 +410,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getEstablecimientos() as $relObj) { $copyObj->addEstablecimiento($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Distritoescolar Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return DistritoescolarPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -725,12 +441,7 @@ return self::$peer; } - /** - * Temporary storage of collEstablecimientos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initEstablecimientos() { if ($this->collEstablecimientos === null) { @@ -738,23 +449,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Distritoescolar has previously - * been saved, it will retrieve related Establecimientos from storage. - * If this Distritoescolar is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getEstablecimientos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -774,13 +472,9 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(EstablecimientoPeer::FK_DISTRITOESCOLAR_ID, $this->getId()); EstablecimientoPeer::addSelectColumns($criteria); @@ -793,18 +487,10 @@ return $this->collEstablecimientos; } - /** - * Returns the number of related Establecimientos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countEstablecimientos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -818,14 +504,7 @@ return EstablecimientoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Establecimiento object to this object - * through the Establecimiento foreign key attribute - * - * @param Establecimiento $l Establecimiento - * @return void - * @throws PropelException - */ + public function addEstablecimiento(Establecimiento $l) { $this->collEstablecimientos[] = $l; @@ -833,21 +512,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Distritoescolar is new, it will return - * an empty collection; or if this Distritoescolar has previously - * been saved, it will retrieve related Establecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Distritoescolar. - */ + public function getEstablecimientosJoinNiveltipo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -866,10 +534,7 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinNiveltipo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EstablecimientoPeer::FK_DISTRITOESCOLAR_ID, $this->getId()); if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) { @@ -882,21 +547,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Distritoescolar is new, it will return - * an empty collection; or if this Distritoescolar has previously - * been saved, it will retrieve related Establecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Distritoescolar. - */ + public function getEstablecimientosJoinOrganizacion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -915,10 +569,7 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinOrganizacion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EstablecimientoPeer::FK_DISTRITOESCOLAR_ID, $this->getId()); if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) { @@ -930,4 +581,4 @@ return $this->collEstablecimientos; } -} // BaseDistritoescolar +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolarPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolarPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDistritoescolarPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by DistritoescolarPeer::getOMClass() -include_once 'model/Distritoescolar.php'; -/** - * Base static class for performing query and update operations on the 'distritoescolar' table. - * - * - * - * @package model.om - */ abstract class BaseDistritoescolarPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'distritoescolar'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Distritoescolar'; + + const CLASS_DEFAULT = 'lib.model.Distritoescolar'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'distritoescolar.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'distritoescolar.NOMBRE'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'distritoescolar.DIRECCION'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'distritoescolar.TELEFONO'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'distritoescolar.CIUDAD'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Direccion', 'Telefono', 'Ciudad', ), BasePeer::TYPE_COLNAME => array (DistritoescolarPeer::ID, DistritoescolarPeer::NOMBRE, DistritoescolarPeer::DIRECCION, DistritoescolarPeer::TELEFONO, DistritoescolarPeer::CIUDAD, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Direccion' => 2, 'Telefono' => 3, 'Ciudad' => 4, ), BasePeer::TYPE_COLNAME => array (DistritoescolarPeer::ID => 0, DistritoescolarPeer::NOMBRE => 1, DistritoescolarPeer::DIRECCION => 2, DistritoescolarPeer::TELEFONO => 3, DistritoescolarPeer::CIUDAD => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/DistritoescolarMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.DistritoescolarMapBuilder'); + include_once 'lib/model/map/DistritoescolarMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.DistritoescolarMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. DistritoescolarPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(DistritoescolarPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(distritoescolar.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT distritoescolar.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DistritoescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DistritoescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Distritoescolar - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return DistritoescolarPeer::populateObjects(DistritoescolarPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ DistritoescolarPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = DistritoescolarPeer::getOMClass(); + $cls = DistritoescolarPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -311,41 +192,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return DistritoescolarPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Distritoescolar or Criteria object. - * - * @param mixed $values Criteria or Distritoescolar object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -353,21 +212,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Distritoescolar object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(DistritoescolarPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(DistritoescolarPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -378,15 +231,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Distritoescolar or Criteria object. - * - * @param mixed $values Criteria or Distritoescolar object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -396,37 +241,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(DistritoescolarPeer::ID); $selectCriteria->add(DistritoescolarPeer::ID, $criteria->remove(DistritoescolarPeer::ID), $comparison); - } else { // $values is Distritoescolar object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the distritoescolar table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(DistritoescolarPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -436,17 +269,7 @@ } } - /** - * Method perform a DELETE on the database, given a Distritoescolar or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Distritoescolar object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -454,25 +277,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Distritoescolar) { + $criteria = clone $values; } elseif ($values instanceof Distritoescolar) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(DistritoescolarPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -483,18 +300,7 @@ } } - /** - * Validates all modified columns of given Distritoescolar object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Distritoescolar $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Distritoescolar $obj, $cols = null) { $columns = array(); @@ -529,13 +335,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Distritoescolar - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -552,14 +352,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -577,20 +370,14 @@ return $objs; } -} // BaseDistritoescolarPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseDistritoescolarPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/DistritoescolarMapBuilder.php'; - Propel::registerMapBuilder('model.map.DistritoescolarMapBuilder'); + require_once 'lib/model/map/DistritoescolarMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.DistritoescolarMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDivision.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDivision.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDivision.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,158 +1,81 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/DivisionPeer.php'; - -/** - * Base class that represents a row from the 'division' table. - * - * - * - * @package model.om - */ abstract class BaseDivision extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var DivisionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_anio_id field. - * @var int - */ + protected $fk_anio_id = 0; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * The value for the fk_turnos_id field. - * @var int - */ + protected $fk_turnos_id = 0; - /** - * @var Anio - */ + protected $aAnio; - /** - * @var Turnos - */ + protected $aTurnos; - /** - * Collection to store aggregation of collRelAlumnoDivisions. - * @var array - */ + protected $collRelAlumnoDivisions; - /** - * The criteria used to select the current contents of collRelAlumnoDivisions. - * @var Criteria - */ + protected $lastRelAlumnoDivisionCriteria = null; - /** - * Collection to store aggregation of collRelDivisionActividadDocentes. - * @var array - */ + protected $collRelDivisionActividadDocentes; - /** - * The criteria used to select the current contents of collRelDivisionActividadDocentes. - * @var Criteria - */ + protected $lastRelDivisionActividadDocenteCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_anio_id] column value. - * - * @return int - */ + public function getFkAnioId() { return $this->fk_anio_id; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [fk_turnos_id] column value. - * - * @return int - */ + public function getFkTurnosId() { return $this->fk_turnos_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -161,14 +84,8 @@ $this->modifiedColumns[] = DivisionPeer::ID; } - } // setId() - - /** - * Set the value of [fk_anio_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAnioId($v) { @@ -181,14 +98,8 @@ $this->aAnio = null; } - } // setFkAnioId() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -197,14 +108,8 @@ $this->modifiedColumns[] = DivisionPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [fk_turnos_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTurnosId($v) { @@ -217,21 +122,8 @@ $this->aTurnos = null; } - } // setFkTurnosId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -248,23 +140,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = DivisionPeer::NUM_COLUMNS - DivisionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Division object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -286,16 +168,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -317,29 +190,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAnio !== null) { if ($this->aAnio->isModified()) { $affectedRows += $this->aAnio->save($con); @@ -355,22 +213,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = DivisionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += DivisionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelAlumnoDivisions !== null) { foreach($this->collRelAlumnoDivisions as $referrerFK) { @@ -391,37 +243,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -434,16 +266,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -453,11 +276,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAnio !== null) { if (!$this->aAnio->validate($columns)) { $failureMap = array_merge($failureMap, $this->aAnio->getValidationFailures()); @@ -499,28 +318,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = DivisionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -539,19 +344,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = DivisionPeer::getFieldNames($keyType); @@ -564,30 +359,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = DivisionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -603,25 +382,9 @@ case 3: $this->setFkTurnosId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = DivisionPeer::getFieldNames($keyType); @@ -632,11 +395,7 @@ if (array_key_exists($keys[3], $arr)) $this->setFkTurnosId($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(DivisionPeer::DATABASE_NAME); @@ -649,14 +408,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(DivisionPeer::DATABASE_NAME); @@ -666,36 +418,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Division (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -707,9 +442,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelAlumnoDivisions() as $relObj) { $copyObj->addRelAlumnoDivision($relObj->copy($deepCopy)); @@ -719,45 +452,23 @@ $copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Division Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return DivisionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -766,13 +477,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Anio object. - * - * @param Anio $v - * @return void - * @throws PropelException - */ + public function setAnio($v) { @@ -788,42 +493,21 @@ } - /** - * Get the associated Anio object - * - * @param Connection Optional Connection object. - * @return Anio The associated Anio object. - * @throws PropelException - */ + public function getAnio($con = null) { - // include the related Peer class - include_once 'model/om/BaseAnioPeer.php'; + include_once 'lib/model/om/BaseAnioPeer.php'; if ($this->aAnio === null && ($this->fk_anio_id !== null)) { $this->aAnio = AnioPeer::retrieveByPK($this->fk_anio_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AnioPeer::retrieveByPK($this->fk_anio_id, $con); - $obj->addAnios($this); - */ + } return $this->aAnio; } - /** - * Declares an association between this object and a Turnos object. - * - * @param Turnos $v - * @return void - * @throws PropelException - */ + public function setTurnos($v) { @@ -839,41 +523,21 @@ } - /** - * Get the associated Turnos object - * - * @param Connection Optional Connection object. - * @return Turnos The associated Turnos object. - * @throws PropelException - */ + public function getTurnos($con = null) { - // include the related Peer class - include_once 'model/om/BaseTurnosPeer.php'; + include_once 'lib/model/om/BaseTurnosPeer.php'; if ($this->aTurnos === null && ($this->fk_turnos_id !== null)) { $this->aTurnos = TurnosPeer::retrieveByPK($this->fk_turnos_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TurnosPeer::retrieveByPK($this->fk_turnos_id, $con); - $obj->addTurnoss($this); - */ + } return $this->aTurnos; } - /** - * Temporary storage of collRelAlumnoDivisions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelAlumnoDivisions() { if ($this->collRelAlumnoDivisions === null) { @@ -881,23 +545,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division has previously - * been saved, it will retrieve related RelAlumnoDivisions from storage. - * If this Division is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelAlumnoDivisions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + include_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -917,13 +568,9 @@ $this->collRelAlumnoDivisions = RelAlumnoDivisionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelAlumnoDivisionPeer::FK_DIVISION_ID, $this->getId()); RelAlumnoDivisionPeer::addSelectColumns($criteria); @@ -936,18 +583,10 @@ return $this->collRelAlumnoDivisions; } - /** - * Returns the number of related RelAlumnoDivisions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelAlumnoDivisions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + include_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -961,14 +600,7 @@ return RelAlumnoDivisionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelAlumnoDivision object to this object - * through the RelAlumnoDivision foreign key attribute - * - * @param RelAlumnoDivision $l RelAlumnoDivision - * @return void - * @throws PropelException - */ + public function addRelAlumnoDivision(RelAlumnoDivision $l) { $this->collRelAlumnoDivisions[] = $l; @@ -976,21 +608,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division is new, it will return - * an empty collection; or if this Division has previously - * been saved, it will retrieve related RelAlumnoDivisions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Division. - */ + public function getRelAlumnoDivisionsJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelAlumnoDivisionPeer.php'; + include_once 'lib/model/om/BaseRelAlumnoDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1009,10 +630,7 @@ $this->collRelAlumnoDivisions = RelAlumnoDivisionPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelAlumnoDivisionPeer::FK_DIVISION_ID, $this->getId()); if (!isset($this->lastRelAlumnoDivisionCriteria) || !$this->lastRelAlumnoDivisionCriteria->equals($criteria)) { @@ -1024,12 +642,7 @@ return $this->collRelAlumnoDivisions; } - /** - * Temporary storage of collRelDivisionActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDivisionActividadDocentes() { if ($this->collRelDivisionActividadDocentes === null) { @@ -1037,23 +650,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * If this Division is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDivisionActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1073,13 +673,9 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $this->getId()); RelDivisionActividadDocentePeer::addSelectColumns($criteria); @@ -1092,18 +688,10 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Returns the number of related RelDivisionActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDivisionActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1117,14 +705,7 @@ return RelDivisionActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDivisionActividadDocente object to this object - * through the RelDivisionActividadDocente foreign key attribute - * - * @param RelDivisionActividadDocente $l RelDivisionActividadDocente - * @return void - * @throws PropelException - */ + public function addRelDivisionActividadDocente(RelDivisionActividadDocente $l) { $this->collRelDivisionActividadDocentes[] = $l; @@ -1132,21 +713,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division is new, it will return - * an empty collection; or if this Division has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Division. - */ + public function getRelDivisionActividadDocentesJoinTipodocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1165,10 +735,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinTipodocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1181,21 +748,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division is new, it will return - * an empty collection; or if this Division has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Division. - */ + public function getRelDivisionActividadDocentesJoinCargobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1214,10 +770,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinCargobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1230,21 +783,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division is new, it will return - * an empty collection; or if this Division has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Division. - */ + public function getRelDivisionActividadDocentesJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1263,10 +805,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1279,21 +818,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division is new, it will return - * an empty collection; or if this Division has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Division. - */ + public function getRelDivisionActividadDocentesJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1312,10 +840,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1328,21 +853,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Division is new, it will return - * an empty collection; or if this Division has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Division. - */ + public function getRelDivisionActividadDocentesJoinRepeticion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1361,10 +875,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinRepeticion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DIVISION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1376,4 +887,4 @@ return $this->collRelDivisionActividadDocentes; } -} // BaseDivision +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDivisionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDivisionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDivisionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by DivisionPeer::getOMClass() -include_once 'model/Division.php'; -/** - * Base static class for performing query and update operations on the 'division' table. - * - * - * - * @package model.om - */ abstract class BaseDivisionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'division'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Division'; + + const CLASS_DEFAULT = 'lib.model.Division'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'division.ID'; - /** the column name for the FK_ANIO_ID field */ + const FK_ANIO_ID = 'division.FK_ANIO_ID'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'division.DESCRIPCION'; - /** the column name for the FK_TURNOS_ID field */ + const FK_TURNOS_ID = 'division.FK_TURNOS_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkAnioId', 'Descripcion', 'FkTurnosId', ), BasePeer::TYPE_COLNAME => array (DivisionPeer::ID, DivisionPeer::FK_ANIO_ID, DivisionPeer::DESCRIPCION, DivisionPeer::FK_TURNOS_ID, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkAnioId' => 1, 'Descripcion' => 2, 'FkTurnosId' => 3, ), BasePeer::TYPE_COLNAME => array (DivisionPeer::ID => 0, DivisionPeer::FK_ANIO_ID => 1, DivisionPeer::DESCRIPCION => 2, DivisionPeer::FK_TURNOS_ID => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/DivisionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.DivisionMapBuilder'); + include_once 'lib/model/map/DivisionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.DivisionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. DivisionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(DivisionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(division.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT division.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Division - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return DivisionPeer::populateObjects(DivisionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ DivisionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = DivisionPeer::getOMClass(); + $cls = DivisionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -307,29 +188,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Anio table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAnio(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -340,35 +211,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Turnos table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTurnos(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -379,25 +239,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Division objects pre-filled with their Anio objects. - * - * @return array Array of Division objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAnio(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -425,37 +277,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAnio(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAnio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addDivision($obj1); //CHECKME - break; + $temp_obj2->addDivision($obj1); break; } } if ($newObject) { $obj2->initDivisions(); - $obj2->addDivision($obj1); //CHECKME - } + $obj2->addDivision($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Division objects pre-filled with their Turnos objects. - * - * @return array Array of Division objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTurnos(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -483,46 +324,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTurnos(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTurnos(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addDivision($obj1); //CHECKME - break; + $temp_obj2->addDivision($obj1); break; } } if ($newObject) { $obj2->initDivisions(); - $obj2->addDivision($obj1); //CHECKME - } + $obj2->addDivision($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -535,25 +363,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Division objects pre-filled with all related objects. - * - * @return array Array of Division objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -583,8 +403,7 @@ $obj1->hydrate($rs); - // Add objects for joined Anio rows - + $omClass = AnioPeer::getOMClass(); @@ -595,11 +414,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAnio(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAnio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addDivision($obj1); // CHECKME - break; + $temp_obj2->addDivision($obj1); break; } } @@ -609,8 +426,7 @@ } - // Add objects for joined Turnos rows - + $omClass = TurnosPeer::getOMClass(); @@ -621,11 +437,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTurnos(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTurnos(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addDivision($obj1); // CHECKME - break; + $temp_obj3->addDivision($obj1); break; } } @@ -640,29 +454,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Anio table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAnio(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -673,35 +477,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Turnos table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTurnos(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -712,27 +505,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Division objects pre-filled with all related objects except Anio. - * - * @return array Array of Division objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAnio(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -766,8 +549,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTurnos(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTurnos(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDivision($obj1); break; @@ -785,21 +567,12 @@ } - /** - * Selects a collection of Division objects pre-filled with all related objects except Turnos. - * - * @return array Array of Division objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTurnos(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -833,8 +606,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAnio(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAnio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDivision($obj1); break; @@ -851,41 +623,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return DivisionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Division or Criteria object. - * - * @param mixed $values Criteria or Division object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -893,21 +643,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Division object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(DivisionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(DivisionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -918,15 +662,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Division or Criteria object. - * - * @param mixed $values Criteria or Division object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -936,37 +672,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(DivisionPeer::ID); $selectCriteria->add(DivisionPeer::ID, $criteria->remove(DivisionPeer::ID), $comparison); - } else { // $values is Division object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the division table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(DivisionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -976,17 +700,7 @@ } } - /** - * Method perform a DELETE on the database, given a Division or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Division object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -994,25 +708,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Division) { + $criteria = clone $values; } elseif ($values instanceof Division) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(DivisionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1023,18 +731,7 @@ } } - /** - * Validates all modified columns of given Division object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Division $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Division $obj, $cols = null) { $columns = array(); @@ -1069,13 +766,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Division - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1092,14 +783,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1117,20 +801,14 @@ return $objs; } -} // BaseDivisionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseDivisionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/DivisionMapBuilder.php'; - Propel::registerMapBuilder('model.map.DivisionMapBuilder'); + require_once 'lib/model/map/DivisionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.DivisionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,292 +1,157 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/DocentePeer.php'; - -/** - * Base class that represents a row from the 'docente' table. - * - * - * - * @package model.om - */ abstract class BaseDocente extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var DocentePeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the apellido field. - * @var string - */ + protected $apellido = ''; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the sexo field. - * @var string - */ + protected $sexo = 'U'; - /** - * The value for the fecha_nacimiento field. - * @var int - */ + protected $fecha_nacimiento; - /** - * The value for the fk_tipodocumento_id field. - * @var int - */ + protected $fk_tipodocumento_id = 0; - /** - * The value for the nro_documento field. - * @var string - */ + protected $nro_documento = ''; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion = ''; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad = ''; - /** - * The value for the codigo_postal field. - * @var string - */ + protected $codigo_postal = ''; - /** - * The value for the email field. - * @var string - */ + protected $email = ''; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono = ''; - /** - * The value for the telefono_movil field. - * @var string - */ + protected $telefono_movil = ''; - /** - * The value for the titulo field. - * @var string - */ + protected $titulo = ''; - /** - * The value for the libreta_sanitaria field. - * @var boolean - */ + protected $libreta_sanitaria = true; - /** - * The value for the psicofisico field. - * @var boolean - */ + protected $psicofisico = true; - /** - * The value for the activo field. - * @var boolean - */ + protected $activo = true; - /** - * The value for the fk_provincia_id field. - * @var int - */ + protected $fk_provincia_id = 0; - /** - * @var Tipodocumento - */ + protected $aTipodocumento; - /** - * @var Provincia - */ + protected $aProvincia; - /** - * Collection to store aggregation of collRelDivisionActividadDocentes. - * @var array - */ + protected $collRelDivisionActividadDocentes; - /** - * The criteria used to select the current contents of collRelDivisionActividadDocentes. - * @var Criteria - */ + protected $lastRelDivisionActividadDocenteCriteria = null; - /** - * Collection to store aggregation of collRelDocenteEstablecimientos. - * @var array - */ + protected $collRelDocenteEstablecimientos; - /** - * The criteria used to select the current contents of collRelDocenteEstablecimientos. - * @var Criteria - */ + protected $lastRelDocenteEstablecimientoCriteria = null; - /** - * Collection to store aggregation of collRelActividadDocentes. - * @var array - */ + protected $collRelActividadDocentes; - /** - * The criteria used to select the current contents of collRelActividadDocentes. - * @var Criteria - */ + protected $lastRelActividadDocenteCriteria = null; - /** - * Collection to store aggregation of collDocenteHorarios. - * @var array - */ + protected $collDocenteHorarios; - /** - * The criteria used to select the current contents of collDocenteHorarios. - * @var Criteria - */ + protected $lastDocenteHorarioCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [apellido] column value. - * - * @return string - */ + public function getApellido() { return $this->apellido; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [sexo] column value. - * - * @return string - */ + public function getSexo() { return $this->sexo; } - /** - * Get the [optionally formatted] [fecha_nacimiento] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaNacimiento($format = 'Y-m-d H:i:s') { if ($this->fecha_nacimiento === null || $this->fecha_nacimiento === '') { return null; } elseif (!is_int($this->fecha_nacimiento)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_nacimiento); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_nacimiento] as date/time value: " . var_export($this->fecha_nacimiento, true)); + $ts = strtotime($this->fecha_nacimiento); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_nacimiento] as date/time value: " . var_export($this->fecha_nacimiento, true)); } } else { $ts = $this->fecha_nacimiento; @@ -300,155 +165,98 @@ } } - /** - * Get the [fk_tipodocumento_id] column value. - * - * @return int - */ + public function getFkTipodocumentoId() { return $this->fk_tipodocumento_id; } - /** - * Get the [nro_documento] column value. - * - * @return string - */ + public function getNroDocumento() { return $this->nro_documento; } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Get the [codigo_postal] column value. - * - * @return string - */ + public function getCodigoPostal() { return $this->codigo_postal; } - /** - * Get the [email] column value. - * - * @return string - */ + public function getEmail() { return $this->email; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [telefono_movil] column value. - * - * @return string - */ + public function getTelefonoMovil() { return $this->telefono_movil; } - /** - * Get the [titulo] column value. - * - * @return string - */ + public function getTitulo() { return $this->titulo; } - /** - * Get the [libreta_sanitaria] column value. - * - * @return boolean - */ + public function getLibretaSanitaria() { return $this->libreta_sanitaria; } - /** - * Get the [psicofisico] column value. - * - * @return boolean - */ + public function getPsicofisico() { return $this->psicofisico; } - /** - * Get the [activo] column value. - * - * @return boolean - */ + public function getActivo() { return $this->activo; } - /** - * Get the [fk_provincia_id] column value. - * - * @return int - */ + public function getFkProvinciaId() { return $this->fk_provincia_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -457,14 +265,8 @@ $this->modifiedColumns[] = DocentePeer::ID; } - } // setId() - - /** - * Set the value of [apellido] column. - * - * @param string $v new value - * @return void - */ + } + public function setApellido($v) { @@ -473,14 +275,8 @@ $this->modifiedColumns[] = DocentePeer::APELLIDO; } - } // setApellido() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -489,14 +285,8 @@ $this->modifiedColumns[] = DocentePeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [sexo] column. - * - * @param string $v new value - * @return void - */ + } + public function setSexo($v) { @@ -505,21 +295,14 @@ $this->modifiedColumns[] = DocentePeer::SEXO; } - } // setSexo() - - /** - * Set the value of [fecha_nacimiento] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaNacimiento($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_nacimiento] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_nacimiento] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -529,14 +312,8 @@ $this->modifiedColumns[] = DocentePeer::FECHA_NACIMIENTO; } - } // setFechaNacimiento() - - /** - * Set the value of [fk_tipodocumento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipodocumentoId($v) { @@ -549,14 +326,8 @@ $this->aTipodocumento = null; } - } // setFkTipodocumentoId() - - /** - * Set the value of [nro_documento] column. - * - * @param string $v new value - * @return void - */ + } + public function setNroDocumento($v) { @@ -565,14 +336,8 @@ $this->modifiedColumns[] = DocentePeer::NRO_DOCUMENTO; } - } // setNroDocumento() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -581,14 +346,8 @@ $this->modifiedColumns[] = DocentePeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -597,14 +356,8 @@ $this->modifiedColumns[] = DocentePeer::CIUDAD; } - } // setCiudad() - - /** - * Set the value of [codigo_postal] column. - * - * @param string $v new value - * @return void - */ + } + public function setCodigoPostal($v) { @@ -613,14 +366,8 @@ $this->modifiedColumns[] = DocentePeer::CODIGO_POSTAL; } - } // setCodigoPostal() - - /** - * Set the value of [email] column. - * - * @param string $v new value - * @return void - */ + } + public function setEmail($v) { @@ -629,14 +376,8 @@ $this->modifiedColumns[] = DocentePeer::EMAIL; } - } // setEmail() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -645,14 +386,8 @@ $this->modifiedColumns[] = DocentePeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [telefono_movil] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefonoMovil($v) { @@ -661,14 +396,8 @@ $this->modifiedColumns[] = DocentePeer::TELEFONO_MOVIL; } - } // setTelefonoMovil() - - /** - * Set the value of [titulo] column. - * - * @param string $v new value - * @return void - */ + } + public function setTitulo($v) { @@ -677,14 +406,8 @@ $this->modifiedColumns[] = DocentePeer::TITULO; } - } // setTitulo() - - /** - * Set the value of [libreta_sanitaria] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setLibretaSanitaria($v) { @@ -693,14 +416,8 @@ $this->modifiedColumns[] = DocentePeer::LIBRETA_SANITARIA; } - } // setLibretaSanitaria() - - /** - * Set the value of [psicofisico] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setPsicofisico($v) { @@ -709,14 +426,8 @@ $this->modifiedColumns[] = DocentePeer::PSICOFISICO; } - } // setPsicofisico() - - /** - * Set the value of [activo] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActivo($v) { @@ -725,14 +436,8 @@ $this->modifiedColumns[] = DocentePeer::ACTIVO; } - } // setActivo() - - /** - * Set the value of [fk_provincia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkProvinciaId($v) { @@ -745,21 +450,8 @@ $this->aProvincia = null; } - } // setFkProvinciaId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -804,23 +496,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 18; // 18 = DocentePeer::NUM_COLUMNS - DocentePeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 18; } catch (Exception $e) { throw new PropelException("Error populating Docente object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -842,16 +524,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -873,29 +546,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipodocumento !== null) { if ($this->aTipodocumento->isModified()) { $affectedRows += $this->aTipodocumento->save($con); @@ -911,22 +569,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = DocentePeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += DocentePeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelDivisionActividadDocentes !== null) { foreach($this->collRelDivisionActividadDocentes as $referrerFK) { @@ -963,37 +615,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -1006,16 +638,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -1025,11 +648,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipodocumento !== null) { if (!$this->aTipodocumento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aTipodocumento->getValidationFailures()); @@ -1087,28 +706,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = DocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -1169,19 +774,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = DocentePeer::getFieldNames($keyType); @@ -1208,30 +803,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = DocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -1289,25 +868,9 @@ case 17: $this->setFkProvinciaId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = DocentePeer::getFieldNames($keyType); @@ -1332,11 +895,7 @@ if (array_key_exists($keys[17], $arr)) $this->setFkProvinciaId($arr[$keys[17]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(DocentePeer::DATABASE_NAME); @@ -1363,14 +922,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(DocentePeer::DATABASE_NAME); @@ -1380,36 +932,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Docente (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1449,9 +984,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelDivisionActividadDocentes() as $relObj) { $copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy)); @@ -1469,45 +1002,23 @@ $copyObj->addDocenteHorario($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Docente Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return DocentePeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1516,13 +1027,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Tipodocumento object. - * - * @param Tipodocumento $v - * @return void - * @throws PropelException - */ + public function setTipodocumento($v) { @@ -1538,42 +1043,21 @@ } - /** - * Get the associated Tipodocumento object - * - * @param Connection Optional Connection object. - * @return Tipodocumento The associated Tipodocumento object. - * @throws PropelException - */ + public function getTipodocumento($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipodocumentoPeer.php'; + include_once 'lib/model/om/BaseTipodocumentoPeer.php'; if ($this->aTipodocumento === null && ($this->fk_tipodocumento_id !== null)) { $this->aTipodocumento = TipodocumentoPeer::retrieveByPK($this->fk_tipodocumento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipodocumentoPeer::retrieveByPK($this->fk_tipodocumento_id, $con); - $obj->addTipodocumentos($this); - */ + } return $this->aTipodocumento; } - /** - * Declares an association between this object and a Provincia object. - * - * @param Provincia $v - * @return void - * @throws PropelException - */ + public function setProvincia($v) { @@ -1589,41 +1073,21 @@ } - /** - * Get the associated Provincia object - * - * @param Connection Optional Connection object. - * @return Provincia The associated Provincia object. - * @throws PropelException - */ + public function getProvincia($con = null) { - // include the related Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($this->aProvincia === null && ($this->fk_provincia_id !== null)) { $this->aProvincia = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - $obj->addProvincias($this); - */ + } return $this->aProvincia; } - /** - * Temporary storage of collRelDivisionActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDivisionActividadDocentes() { if ($this->collRelDivisionActividadDocentes === null) { @@ -1631,23 +1095,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * If this Docente is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDivisionActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1667,13 +1118,9 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDivisionActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); RelDivisionActividadDocentePeer::addSelectColumns($criteria); @@ -1686,18 +1133,10 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Returns the number of related RelDivisionActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDivisionActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1711,14 +1150,7 @@ return RelDivisionActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDivisionActividadDocente object to this object - * through the RelDivisionActividadDocente foreign key attribute - * - * @param RelDivisionActividadDocente $l RelDivisionActividadDocente - * @return void - * @throws PropelException - */ + public function addRelDivisionActividadDocente(RelDivisionActividadDocente $l) { $this->collRelDivisionActividadDocentes[] = $l; @@ -1726,21 +1158,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelDivisionActividadDocentesJoinDivision($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1759,10 +1180,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDivision($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1775,21 +1193,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelDivisionActividadDocentesJoinTipodocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1808,10 +1215,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinTipodocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1824,21 +1228,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelDivisionActividadDocentesJoinCargobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1857,10 +1250,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinCargobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1873,21 +1263,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelDivisionActividadDocentesJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1906,10 +1285,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1922,21 +1298,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelDivisionActividadDocentesJoinRepeticion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1955,10 +1320,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinRepeticion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1970,12 +1332,7 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Temporary storage of collRelDocenteEstablecimientos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDocenteEstablecimientos() { if ($this->collRelDocenteEstablecimientos === null) { @@ -1983,23 +1340,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente has previously - * been saved, it will retrieve related RelDocenteEstablecimientos from storage. - * If this Docente is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDocenteEstablecimientos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2019,13 +1363,9 @@ $this->collRelDocenteEstablecimientos = RelDocenteEstablecimientoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDocenteEstablecimientoPeer::FK_DOCENTE_ID, $this->getId()); RelDocenteEstablecimientoPeer::addSelectColumns($criteria); @@ -2038,18 +1378,10 @@ return $this->collRelDocenteEstablecimientos; } - /** - * Returns the number of related RelDocenteEstablecimientos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDocenteEstablecimientos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2063,14 +1395,7 @@ return RelDocenteEstablecimientoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDocenteEstablecimiento object to this object - * through the RelDocenteEstablecimiento foreign key attribute - * - * @param RelDocenteEstablecimiento $l RelDocenteEstablecimiento - * @return void - * @throws PropelException - */ + public function addRelDocenteEstablecimiento(RelDocenteEstablecimiento $l) { $this->collRelDocenteEstablecimientos[] = $l; @@ -2078,21 +1403,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelDocenteEstablecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelDocenteEstablecimientosJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2111,10 +1425,7 @@ $this->collRelDocenteEstablecimientos = RelDocenteEstablecimientoPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDocenteEstablecimientoPeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelDocenteEstablecimientoCriteria) || !$this->lastRelDocenteEstablecimientoCriteria->equals($criteria)) { @@ -2126,12 +1437,7 @@ return $this->collRelDocenteEstablecimientos; } - /** - * Temporary storage of collRelActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelActividadDocentes() { if ($this->collRelActividadDocentes === null) { @@ -2139,23 +1445,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente has previously - * been saved, it will retrieve related RelActividadDocentes from storage. - * If this Docente is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2175,13 +1468,9 @@ $this->collRelActividadDocentes = RelActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); RelActividadDocentePeer::addSelectColumns($criteria); @@ -2194,18 +1483,10 @@ return $this->collRelActividadDocentes; } - /** - * Returns the number of related RelActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2219,14 +1500,7 @@ return RelActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelActividadDocente object to this object - * through the RelActividadDocente foreign key attribute - * - * @param RelActividadDocente $l RelActividadDocente - * @return void - * @throws PropelException - */ + public function addRelActividadDocente(RelActividadDocente $l) { $this->collRelActividadDocentes[] = $l; @@ -2234,21 +1508,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related RelActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getRelActividadDocentesJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2267,10 +1530,7 @@ $this->collRelActividadDocentes = RelActividadDocentePeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelActividadDocentePeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastRelActividadDocenteCriteria) || !$this->lastRelActividadDocenteCriteria->equals($criteria)) { @@ -2282,12 +1542,7 @@ return $this->collRelActividadDocentes; } - /** - * Temporary storage of collDocenteHorarios to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initDocenteHorarios() { if ($this->collDocenteHorarios === null) { @@ -2295,23 +1550,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente has previously - * been saved, it will retrieve related DocenteHorarios from storage. - * If this Docente is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getDocenteHorarios($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocenteHorarioPeer.php'; + include_once 'lib/model/om/BaseDocenteHorarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2331,13 +1573,9 @@ $this->collDocenteHorarios = DocenteHorarioPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->getId()); DocenteHorarioPeer::addSelectColumns($criteria); @@ -2350,18 +1588,10 @@ return $this->collDocenteHorarios; } - /** - * Returns the number of related DocenteHorarios. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countDocenteHorarios($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocenteHorarioPeer.php'; + include_once 'lib/model/om/BaseDocenteHorarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2375,14 +1605,7 @@ return DocenteHorarioPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a DocenteHorario object to this object - * through the DocenteHorario foreign key attribute - * - * @param DocenteHorario $l DocenteHorario - * @return void - * @throws PropelException - */ + public function addDocenteHorario(DocenteHorario $l) { $this->collDocenteHorarios[] = $l; @@ -2390,21 +1613,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Docente is new, it will return - * an empty collection; or if this Docente has previously - * been saved, it will retrieve related DocenteHorarios from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Docente. - */ + public function getDocenteHorariosJoinRepeticion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocenteHorarioPeer.php'; + include_once 'lib/model/om/BaseDocenteHorarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2423,10 +1635,7 @@ $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinRepeticion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->getId()); if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) { @@ -2438,4 +1647,4 @@ return $this->collDocenteHorarios; } -} // BaseDocente +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,149 +1,78 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/DocenteHorarioPeer.php'; - -/** - * Base class that represents a row from the 'docente_horario' table. - * - * - * - * @package model.om - */ abstract class BaseDocenteHorario extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var DocenteHorarioPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_docente_id field. - * @var int - */ + protected $fk_docente_id = 0; - /** - * The value for the fk_repeticion_id field. - * @var int - */ + protected $fk_repeticion_id = 0; - /** - * The value for the hora_inicio field. - * @var int - */ + protected $hora_inicio; - /** - * The value for the hora_fin field. - * @var int - */ + protected $hora_fin; - /** - * The value for the dia field. - * @var int - */ + protected $dia = 0; - /** - * @var Repeticion - */ + protected $aRepeticion; - /** - * @var Docente - */ + protected $aDocente; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_docente_id] column value. - * - * @return int - */ + public function getFkDocenteId() { return $this->fk_docente_id; } - /** - * Get the [fk_repeticion_id] column value. - * - * @return int - */ + public function getFkRepeticionId() { return $this->fk_repeticion_id; } - /** - * Get the [optionally formatted] [hora_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraInicio($format = '%X') + + public function getHoraInicio($format = 'H:i:s') { if ($this->hora_inicio === null || $this->hora_inicio === '') { return null; } elseif (!is_int($this->hora_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); + $ts = strtotime($this->hora_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); } } else { $ts = $this->hora_inicio; @@ -157,24 +86,15 @@ } } - /** - * Get the [optionally formatted] [hora_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraFin($format = '%X') + + public function getHoraFin($format = 'H:i:s') { if ($this->hora_fin === null || $this->hora_fin === '') { return null; } elseif (!is_int($this->hora_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); + $ts = strtotime($this->hora_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); } } else { $ts = $this->hora_fin; @@ -188,23 +108,14 @@ } } - /** - * Get the [dia] column value. - * - * @return int - */ + public function getDia() { return $this->dia; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -213,14 +124,8 @@ $this->modifiedColumns[] = DocenteHorarioPeer::ID; } - } // setId() - - /** - * Set the value of [fk_docente_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDocenteId($v) { @@ -233,14 +138,8 @@ $this->aDocente = null; } - } // setFkDocenteId() - - /** - * Set the value of [fk_repeticion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkRepeticionId($v) { @@ -253,21 +152,14 @@ $this->aRepeticion = null; } - } // setFkRepeticionId() - - /** - * Set the value of [hora_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -277,21 +169,14 @@ $this->modifiedColumns[] = DocenteHorarioPeer::HORA_INICIO; } - } // setHoraInicio() - - /** - * Set the value of [hora_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -301,14 +186,8 @@ $this->modifiedColumns[] = DocenteHorarioPeer::HORA_FIN; } - } // setHoraFin() - - /** - * Set the value of [dia] column. - * - * @param int $v new value - * @return void - */ + } + public function setDia($v) { @@ -317,21 +196,8 @@ $this->modifiedColumns[] = DocenteHorarioPeer::DIA; } - } // setDia() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -352,23 +218,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = DocenteHorarioPeer::NUM_COLUMNS - DocenteHorarioPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating DocenteHorario object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -390,16 +246,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -421,29 +268,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aRepeticion !== null) { if ($this->aRepeticion->isModified()) { $affectedRows += $this->aRepeticion->save($con); @@ -459,57 +291,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = DocenteHorarioPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += DocenteHorarioPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -522,16 +328,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -541,11 +338,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aRepeticion !== null) { if (!$this->aRepeticion->validate($columns)) { $failureMap = array_merge($failureMap, $this->aRepeticion->getValidationFailures()); @@ -571,28 +364,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = DocenteHorarioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -617,19 +396,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = DocenteHorarioPeer::getFieldNames($keyType); @@ -644,30 +413,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = DocenteHorarioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -689,25 +442,9 @@ case 5: $this->setDia($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = DocenteHorarioPeer::getFieldNames($keyType); @@ -720,11 +457,7 @@ if (array_key_exists($keys[5], $arr)) $this->setDia($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(DocenteHorarioPeer::DATABASE_NAME); @@ -739,14 +472,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(DocenteHorarioPeer::DATABASE_NAME); @@ -756,36 +482,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of DocenteHorario (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -802,40 +511,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return DocenteHorario Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return DocenteHorarioPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -844,13 +532,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Repeticion object. - * - * @param Repeticion $v - * @return void - * @throws PropelException - */ + public function setRepeticion($v) { @@ -866,42 +548,21 @@ } - /** - * Get the associated Repeticion object - * - * @param Connection Optional Connection object. - * @return Repeticion The associated Repeticion object. - * @throws PropelException - */ + public function getRepeticion($con = null) { - // include the related Peer class - include_once 'model/om/BaseRepeticionPeer.php'; + include_once 'lib/model/om/BaseRepeticionPeer.php'; if ($this->aRepeticion === null && ($this->fk_repeticion_id !== null)) { $this->aRepeticion = RepeticionPeer::retrieveByPK($this->fk_repeticion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = RepeticionPeer::retrieveByPK($this->fk_repeticion_id, $con); - $obj->addRepeticions($this); - */ + } return $this->aRepeticion; } - /** - * Declares an association between this object and a Docente object. - * - * @param Docente $v - * @return void - * @throws PropelException - */ + public function setDocente($v) { @@ -917,33 +578,18 @@ } - /** - * Get the associated Docente object - * - * @param Connection Optional Connection object. - * @return Docente The associated Docente object. - * @throws PropelException - */ + public function getDocente($con = null) { - // include the related Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($this->aDocente === null && ($this->fk_docente_id !== null)) { $this->aDocente = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - $obj->addDocentes($this); - */ + } return $this->aDocente; } -} // BaseDocenteHorario +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by DocenteHorarioPeer::getOMClass() -include_once 'model/DocenteHorario.php'; -/** - * Base static class for performing query and update operations on the 'docente_horario' table. - * - * - * - * @package model.om - */ abstract class BaseDocenteHorarioPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'docente_horario'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.DocenteHorario'; + + const CLASS_DEFAULT = 'lib.model.DocenteHorario'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'docente_horario.ID'; - /** the column name for the FK_DOCENTE_ID field */ + const FK_DOCENTE_ID = 'docente_horario.FK_DOCENTE_ID'; - /** the column name for the FK_REPETICION_ID field */ + const FK_REPETICION_ID = 'docente_horario.FK_REPETICION_ID'; - /** the column name for the HORA_INICIO field */ + const HORA_INICIO = 'docente_horario.HORA_INICIO'; - /** the column name for the HORA_FIN field */ + const HORA_FIN = 'docente_horario.HORA_FIN'; - /** the column name for the DIA field */ + const DIA = 'docente_horario.DIA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkDocenteId', 'FkRepeticionId', 'HoraInicio', 'HoraFin', 'Dia', ), BasePeer::TYPE_COLNAME => array (DocenteHorarioPeer::ID, DocenteHorarioPeer::FK_DOCENTE_ID, DocenteHorarioPeer::FK_REPETICION_ID, DocenteHorarioPeer::HORA_INICIO, DocenteHorarioPeer::HORA_FIN, DocenteHorarioPeer::DIA, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkDocenteId' => 1, 'FkRepeticionId' => 2, 'HoraInicio' => 3, 'HoraFin' => 4, 'Dia' => 5, ), BasePeer::TYPE_COLNAME => array (DocenteHorarioPeer::ID => 0, DocenteHorarioPeer::FK_DOCENTE_ID => 1, DocenteHorarioPeer::FK_REPETICION_ID => 2, DocenteHorarioPeer::HORA_INICIO => 3, DocenteHorarioPeer::HORA_FIN => 4, DocenteHorarioPeer::DIA => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/DocenteHorarioMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.DocenteHorarioMapBuilder'); + include_once 'lib/model/map/DocenteHorarioMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.DocenteHorarioMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. DocenteHorarioPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(DocenteHorarioPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(docente_horario.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT docente_horario.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return DocenteHorario - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return DocenteHorarioPeer::populateObjects(DocenteHorarioPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ DocenteHorarioPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = DocenteHorarioPeer::getOMClass(); + $cls = DocenteHorarioPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -317,29 +198,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Repeticion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinRepeticion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -350,35 +221,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -389,25 +249,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of DocenteHorario objects pre-filled with their Repeticion objects. - * - * @return array Array of DocenteHorario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinRepeticion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -435,37 +287,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addDocenteHorario($obj1); //CHECKME - break; + $temp_obj2->addDocenteHorario($obj1); break; } } if ($newObject) { $obj2->initDocenteHorarios(); - $obj2->addDocenteHorario($obj1); //CHECKME - } + $obj2->addDocenteHorario($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of DocenteHorario objects pre-filled with their Docente objects. - * - * @return array Array of DocenteHorario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -493,46 +334,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addDocenteHorario($obj1); //CHECKME - break; + $temp_obj2->addDocenteHorario($obj1); break; } } if ($newObject) { $obj2->initDocenteHorarios(); - $obj2->addDocenteHorario($obj1); //CHECKME - } + $obj2->addDocenteHorario($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -545,25 +373,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of DocenteHorario objects pre-filled with all related objects. - * - * @return array Array of DocenteHorario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -593,8 +413,7 @@ $obj1->hydrate($rs); - // Add objects for joined Repeticion rows - + $omClass = RepeticionPeer::getOMClass(); @@ -605,11 +424,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getRepeticion(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addDocenteHorario($obj1); // CHECKME - break; + $temp_obj2->addDocenteHorario($obj1); break; } } @@ -619,8 +436,7 @@ } - // Add objects for joined Docente rows - + $omClass = DocentePeer::getOMClass(); @@ -631,11 +447,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getDocente(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getDocente(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addDocenteHorario($obj1); // CHECKME - break; + $temp_obj3->addDocenteHorario($obj1); break; } } @@ -650,29 +464,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Repeticion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptRepeticion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -683,35 +487,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocenteHorarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -722,27 +515,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of DocenteHorario objects pre-filled with all related objects except Repeticion. - * - * @return array Array of DocenteHorario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptRepeticion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -776,8 +559,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDocenteHorario($obj1); break; @@ -795,21 +577,12 @@ } - /** - * Selects a collection of DocenteHorario objects pre-filled with all related objects except Docente. - * - * @return array Array of DocenteHorario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -843,8 +616,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDocenteHorario($obj1); break; @@ -861,41 +633,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return DocenteHorarioPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a DocenteHorario or Criteria object. - * - * @param mixed $values Criteria or DocenteHorario object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -903,21 +653,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from DocenteHorario object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(DocenteHorarioPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(DocenteHorarioPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -928,15 +672,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a DocenteHorario or Criteria object. - * - * @param mixed $values Criteria or DocenteHorario object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -946,37 +682,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(DocenteHorarioPeer::ID); $selectCriteria->add(DocenteHorarioPeer::ID, $criteria->remove(DocenteHorarioPeer::ID), $comparison); - } else { // $values is DocenteHorario object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the docente_horario table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(DocenteHorarioPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -986,17 +710,7 @@ } } - /** - * Method perform a DELETE on the database, given a DocenteHorario or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or DocenteHorario object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1004,25 +718,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof DocenteHorario) { + $criteria = clone $values; } elseif ($values instanceof DocenteHorario) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(DocenteHorarioPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1033,18 +741,7 @@ } } - /** - * Validates all modified columns of given DocenteHorario object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param DocenteHorario $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(DocenteHorario $obj, $cols = null) { $columns = array(); @@ -1079,13 +776,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return DocenteHorario - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1102,14 +793,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1127,20 +811,14 @@ return $objs; } -} // BaseDocenteHorarioPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseDocenteHorarioPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/DocenteHorarioMapBuilder.php'; - Propel::registerMapBuilder('model.map.DocenteHorarioMapBuilder'); + require_once 'lib/model/map/DocenteHorarioMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.DocenteHorarioMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseDocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseDocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,99 +1,83 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by DocentePeer::getOMClass() -include_once 'model/Docente.php'; -/** - * Base static class for performing query and update operations on the 'docente' table. - * - * - * - * @package model.om - */ abstract class BaseDocentePeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'docente'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Docente'; + + const CLASS_DEFAULT = 'lib.model.Docente'; - /** The total number of columns. */ + const NUM_COLUMNS = 18; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'docente.ID'; - /** the column name for the APELLIDO field */ + const APELLIDO = 'docente.APELLIDO'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'docente.NOMBRE'; - /** the column name for the SEXO field */ + const SEXO = 'docente.SEXO'; - /** the column name for the FECHA_NACIMIENTO field */ + const FECHA_NACIMIENTO = 'docente.FECHA_NACIMIENTO'; - /** the column name for the FK_TIPODOCUMENTO_ID field */ + const FK_TIPODOCUMENTO_ID = 'docente.FK_TIPODOCUMENTO_ID'; - /** the column name for the NRO_DOCUMENTO field */ + const NRO_DOCUMENTO = 'docente.NRO_DOCUMENTO'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'docente.DIRECCION'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'docente.CIUDAD'; - /** the column name for the CODIGO_POSTAL field */ + const CODIGO_POSTAL = 'docente.CODIGO_POSTAL'; - /** the column name for the EMAIL field */ + const EMAIL = 'docente.EMAIL'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'docente.TELEFONO'; - /** the column name for the TELEFONO_MOVIL field */ + const TELEFONO_MOVIL = 'docente.TELEFONO_MOVIL'; - /** the column name for the TITULO field */ + const TITULO = 'docente.TITULO'; - /** the column name for the LIBRETA_SANITARIA field */ + const LIBRETA_SANITARIA = 'docente.LIBRETA_SANITARIA'; - /** the column name for the PSICOFISICO field */ + const PSICOFISICO = 'docente.PSICOFISICO'; - /** the column name for the ACTIVO field */ + const ACTIVO = 'docente.ACTIVO'; - /** the column name for the FK_PROVINCIA_ID field */ + const FK_PROVINCIA_ID = 'docente.FK_PROVINCIA_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Apellido', 'Nombre', 'Sexo', 'FechaNacimiento', 'FkTipodocumentoId', 'NroDocumento', 'Direccion', 'Ciudad', 'CodigoPostal', 'Email', 'Telefono', 'TelefonoMovil', 'Titulo', 'LibretaSanitaria', 'Psicofisico', 'Activo', 'FkProvinciaId', ), BasePeer::TYPE_COLNAME => array (DocentePeer::ID, DocentePeer::APELLIDO, DocentePeer::NOMBRE, DocentePeer::SEXO, DocentePeer::FECHA_NACIMIENTO, DocentePeer::FK_TIPODOCUMENTO_ID, DocentePeer::NRO_DOCUMENTO, DocentePeer::DIRECCION, DocentePeer::CIUDAD, DocentePeer::CODIGO_POSTAL, DocentePeer::EMAIL, DocentePeer::TELEFONO, DocentePeer::TELEFONO_MOVIL, DocentePeer::TITULO, DocentePeer::LIBRETA_SANITARIA, DocentePeer::PSICOFISICO, DocentePeer::ACTIVO, DocentePeer::FK_PROVINCIA_ID, ), @@ -101,12 +85,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Apellido' => 1, 'Nombre' => 2, 'Sexo' => 3, 'FechaNacimiento' => 4, 'FkTipodocumentoId' => 5, 'NroDocumento' => 6, 'Direccion' => 7, 'Ciudad' => 8, 'CodigoPostal' => 9, 'Email' => 10, 'Telefono' => 11, 'TelefonoMovil' => 12, 'Titulo' => 13, 'LibretaSanitaria' => 14, 'Psicofisico' => 15, 'Activo' => 16, 'FkProvinciaId' => 17, ), BasePeer::TYPE_COLNAME => array (DocentePeer::ID => 0, DocentePeer::APELLIDO => 1, DocentePeer::NOMBRE => 2, DocentePeer::SEXO => 3, DocentePeer::FECHA_NACIMIENTO => 4, DocentePeer::FK_TIPODOCUMENTO_ID => 5, DocentePeer::NRO_DOCUMENTO => 6, DocentePeer::DIRECCION => 7, DocentePeer::CIUDAD => 8, DocentePeer::CODIGO_POSTAL => 9, DocentePeer::EMAIL => 10, DocentePeer::TELEFONO => 11, DocentePeer::TELEFONO_MOVIL => 12, DocentePeer::TITULO => 13, DocentePeer::LIBRETA_SANITARIA => 14, DocentePeer::PSICOFISICO => 15, DocentePeer::ACTIVO => 16, DocentePeer::FK_PROVINCIA_ID => 17, ), @@ -114,24 +93,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/DocenteMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.DocenteMapBuilder'); + include_once 'lib/model/map/DocenteMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.DocenteMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -145,15 +113,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -164,14 +124,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -181,34 +134,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. DocentePeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(DocentePeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -253,29 +185,19 @@ const COUNT = 'COUNT(docente.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT docente.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -284,19 +206,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Docente - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -307,33 +220,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return DocentePeer::populateObjects(DocentePeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -345,29 +237,18 @@ DocentePeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = DocentePeer::getOMClass(); + $cls = DocentePeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -377,29 +258,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Tipodocumento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipodocumento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -410,35 +281,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -449,25 +309,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Docente objects pre-filled with their Tipodocumento objects. - * - * @return array Array of Docente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipodocumento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -495,37 +347,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addDocente($obj1); //CHECKME - break; + $temp_obj2->addDocente($obj1); break; } } if ($newObject) { $obj2->initDocentes(); - $obj2->addDocente($obj1); //CHECKME - } + $obj2->addDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Docente objects pre-filled with their Provincia objects. - * - * @return array Array of Docente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -553,46 +394,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addDocente($obj1); //CHECKME - break; + $temp_obj2->addDocente($obj1); break; } } if ($newObject) { $obj2->initDocentes(); - $obj2->addDocente($obj1); //CHECKME - } + $obj2->addDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -605,25 +433,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Docente objects pre-filled with all related objects. - * - * @return array Array of Docente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -653,8 +473,7 @@ $obj1->hydrate($rs); - // Add objects for joined Tipodocumento rows - + $omClass = TipodocumentoPeer::getOMClass(); @@ -665,11 +484,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addDocente($obj1); // CHECKME - break; + $temp_obj2->addDocente($obj1); break; } } @@ -679,8 +496,7 @@ } - // Add objects for joined Provincia rows - + $omClass = ProvinciaPeer::getOMClass(); @@ -691,11 +507,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getProvincia(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getProvincia(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addDocente($obj1); // CHECKME - break; + $temp_obj3->addDocente($obj1); break; } } @@ -710,29 +524,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Tipodocumento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipodocumento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -743,35 +547,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(DocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(DocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -782,27 +575,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Docente objects pre-filled with all related objects except Tipodocumento. - * - * @return array Array of Docente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipodocumento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -836,8 +619,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDocente($obj1); break; @@ -855,21 +637,12 @@ } - /** - * Selects a collection of Docente objects pre-filled with all related objects except Provincia. - * - * @return array Array of Docente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -903,8 +676,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDocente($obj1); break; @@ -921,41 +693,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return DocentePeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Docente or Criteria object. - * - * @param mixed $values Criteria or Docente object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -963,21 +713,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Docente object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(DocentePeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(DocentePeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -988,15 +732,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Docente or Criteria object. - * - * @param mixed $values Criteria or Docente object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1006,37 +742,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(DocentePeer::ID); $selectCriteria->add(DocentePeer::ID, $criteria->remove(DocentePeer::ID), $comparison); - } else { // $values is Docente object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the docente table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(DocentePeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1046,17 +770,7 @@ } } - /** - * Method perform a DELETE on the database, given a Docente or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Docente object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1064,25 +778,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Docente) { + $criteria = clone $values; } elseif ($values instanceof Docente) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(DocentePeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1093,18 +801,7 @@ } } - /** - * Validates all modified columns of given Docente object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Docente $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Docente $obj, $cols = null) { $columns = array(); @@ -1139,13 +836,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Docente - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1162,14 +853,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1187,20 +871,14 @@ return $objs; } -} // BaseDocentePeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseDocentePeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/DocenteMapBuilder.php'; - Propel::registerMapBuilder('model.map.DocenteMapBuilder'); + require_once 'lib/model/map/DocenteMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.DocenteMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEscalanota.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEscalanota.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEscalanota.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,201 +1,106 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/EscalanotaPeer.php'; - -/** - * Base class that represents a row from the 'escalanota' table. - * - * - * - * @package model.om - */ abstract class BaseEscalanota extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var EscalanotaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the orden field. - * @var int - */ + protected $orden; - /** - * The value for the aprobado field. - * @var boolean - */ + protected $aprobado = true; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Collection to store aggregation of collBoletinConceptuals. - * @var array - */ + protected $collBoletinConceptuals; - /** - * The criteria used to select the current contents of collBoletinConceptuals. - * @var Criteria - */ + protected $lastBoletinConceptualCriteria = null; - /** - * Collection to store aggregation of collBoletinActividadess. - * @var array - */ + protected $collBoletinActividadess; - /** - * The criteria used to select the current contents of collBoletinActividadess. - * @var Criteria - */ + protected $lastBoletinActividadesCriteria = null; - /** - * Collection to store aggregation of collExamens. - * @var array - */ + protected $collExamens; - /** - * The criteria used to select the current contents of collExamens. - * @var Criteria - */ + protected $lastExamenCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [orden] column value. - * - * @return int - */ + public function getOrden() { return $this->orden; } - /** - * Get the [aprobado] column value. - * - * @return boolean - */ + public function getAprobado() { return $this->aprobado; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -204,14 +109,8 @@ $this->modifiedColumns[] = EscalanotaPeer::ID; } - } // setId() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -224,14 +123,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -240,14 +133,8 @@ $this->modifiedColumns[] = EscalanotaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -256,14 +143,8 @@ $this->modifiedColumns[] = EscalanotaPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [orden] column. - * - * @param int $v new value - * @return void - */ + } + public function setOrden($v) { @@ -272,14 +153,8 @@ $this->modifiedColumns[] = EscalanotaPeer::ORDEN; } - } // setOrden() - - /** - * Set the value of [aprobado] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setAprobado($v) { @@ -288,21 +163,8 @@ $this->modifiedColumns[] = EscalanotaPeer::APROBADO; } - } // setAprobado() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -323,23 +185,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = EscalanotaPeer::NUM_COLUMNS - EscalanotaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating Escalanota object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -361,16 +213,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -392,29 +235,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -423,22 +251,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = EscalanotaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += EscalanotaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collBoletinConceptuals !== null) { foreach($this->collBoletinConceptuals as $referrerFK) { @@ -467,37 +289,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -510,16 +312,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -529,11 +322,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -577,28 +366,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = EscalanotaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -623,19 +398,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = EscalanotaPeer::getFieldNames($keyType); @@ -650,30 +415,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = EscalanotaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -695,25 +444,9 @@ case 5: $this->setAprobado($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EscalanotaPeer::getFieldNames($keyType); @@ -726,11 +459,7 @@ if (array_key_exists($keys[5], $arr)) $this->setAprobado($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(EscalanotaPeer::DATABASE_NAME); @@ -745,14 +474,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(EscalanotaPeer::DATABASE_NAME); @@ -762,36 +484,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Escalanota (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -807,9 +512,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getBoletinConceptuals() as $relObj) { $copyObj->addBoletinConceptual($relObj->copy($deepCopy)); @@ -823,45 +526,23 @@ $copyObj->addExamen($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Escalanota Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return EscalanotaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -870,13 +551,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -892,41 +567,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Temporary storage of collBoletinConceptuals to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinConceptuals() { if ($this->collBoletinConceptuals === null) { @@ -934,23 +589,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * If this Escalanota is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinConceptuals($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -970,13 +612,9 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinConceptualPeer::FK_ESCALANOTA_ID, $this->getId()); BoletinConceptualPeer::addSelectColumns($criteria); @@ -989,18 +627,10 @@ return $this->collBoletinConceptuals; } - /** - * Returns the number of related BoletinConceptuals. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinConceptuals($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1014,14 +644,7 @@ return BoletinConceptualPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinConceptual object to this object - * through the BoletinConceptual foreign key attribute - * - * @param BoletinConceptual $l BoletinConceptual - * @return void - * @throws PropelException - */ + public function addBoletinConceptual(BoletinConceptual $l) { $this->collBoletinConceptuals[] = $l; @@ -1029,21 +652,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getBoletinConceptualsJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1062,10 +674,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1078,21 +687,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getBoletinConceptualsJoinConcepto($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1111,10 +709,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinConcepto($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1127,21 +722,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getBoletinConceptualsJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1160,10 +744,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1175,12 +756,7 @@ return $this->collBoletinConceptuals; } - /** - * Temporary storage of collBoletinActividadess to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinActividadess() { if ($this->collBoletinActividadess === null) { @@ -1188,23 +764,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * If this Escalanota is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinActividadess($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1224,13 +787,9 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinActividadesPeer::FK_ESCALANOTA_ID, $this->getId()); BoletinActividadesPeer::addSelectColumns($criteria); @@ -1243,18 +802,10 @@ return $this->collBoletinActividadess; } - /** - * Returns the number of related BoletinActividadess. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinActividadess($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1268,14 +819,7 @@ return BoletinActividadesPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinActividades object to this object - * through the BoletinActividades foreign key attribute - * - * @param BoletinActividades $l BoletinActividades - * @return void - * @throws PropelException - */ + public function addBoletinActividades(BoletinActividades $l) { $this->collBoletinActividadess[] = $l; @@ -1283,21 +827,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getBoletinActividadessJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1316,10 +849,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1332,21 +862,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getBoletinActividadessJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1365,10 +884,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1381,21 +897,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getBoletinActividadessJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1414,10 +919,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1429,12 +931,7 @@ return $this->collBoletinActividadess; } - /** - * Temporary storage of collExamens to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initExamens() { if ($this->collExamens === null) { @@ -1442,23 +939,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota has previously - * been saved, it will retrieve related Examens from storage. - * If this Escalanota is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getExamens($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1478,13 +962,9 @@ $this->collExamens = ExamenPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ExamenPeer::FK_ESCALANOTA_ID, $this->getId()); ExamenPeer::addSelectColumns($criteria); @@ -1497,18 +977,10 @@ return $this->collExamens; } - /** - * Returns the number of related Examens. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countExamens($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1522,14 +994,7 @@ return ExamenPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Examen object to this object - * through the Examen foreign key attribute - * - * @param Examen $l Examen - * @return void - * @throws PropelException - */ + public function addExamen(Examen $l) { $this->collExamens[] = $l; @@ -1537,21 +1002,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getExamensJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1570,10 +1024,7 @@ $this->collExamens = ExamenPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1586,21 +1037,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getExamensJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1619,10 +1059,7 @@ $this->collExamens = ExamenPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1635,21 +1072,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Escalanota is new, it will return - * an empty collection; or if this Escalanota has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Escalanota. - */ + public function getExamensJoinPeriodo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1668,10 +1094,7 @@ $this->collExamens = ExamenPeer::doSelectJoinPeriodo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_ESCALANOTA_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1683,4 +1106,4 @@ return $this->collExamens; } -} // BaseEscalanota +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEscalanotaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEscalanotaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEscalanotaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by EscalanotaPeer::getOMClass() -include_once 'model/Escalanota.php'; -/** - * Base static class for performing query and update operations on the 'escalanota' table. - * - * - * - * @package model.om - */ abstract class BaseEscalanotaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'escalanota'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Escalanota'; + + const CLASS_DEFAULT = 'lib.model.Escalanota'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'escalanota.ID'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'escalanota.FK_ESTABLECIMIENTO_ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'escalanota.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'escalanota.DESCRIPCION'; - /** the column name for the ORDEN field */ + const ORDEN = 'escalanota.ORDEN'; - /** the column name for the APROBADO field */ + const APROBADO = 'escalanota.APROBADO'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEstablecimientoId', 'Nombre', 'Descripcion', 'Orden', 'Aprobado', ), BasePeer::TYPE_COLNAME => array (EscalanotaPeer::ID, EscalanotaPeer::FK_ESTABLECIMIENTO_ID, EscalanotaPeer::NOMBRE, EscalanotaPeer::DESCRIPCION, EscalanotaPeer::ORDEN, EscalanotaPeer::APROBADO, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEstablecimientoId' => 1, 'Nombre' => 2, 'Descripcion' => 3, 'Orden' => 4, 'Aprobado' => 5, ), BasePeer::TYPE_COLNAME => array (EscalanotaPeer::ID => 0, EscalanotaPeer::FK_ESTABLECIMIENTO_ID => 1, EscalanotaPeer::NOMBRE => 2, EscalanotaPeer::DESCRIPCION => 3, EscalanotaPeer::ORDEN => 4, EscalanotaPeer::APROBADO => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/EscalanotaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.EscalanotaMapBuilder'); + include_once 'lib/model/map/EscalanotaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.EscalanotaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. EscalanotaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(EscalanotaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(escalanota.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT escalanota.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EscalanotaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EscalanotaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Escalanota - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return EscalanotaPeer::populateObjects(EscalanotaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ EscalanotaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = EscalanotaPeer::getOMClass(); + $cls = EscalanotaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -317,29 +198,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EscalanotaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EscalanotaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -350,25 +221,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Escalanota objects pre-filled with their Establecimiento objects. - * - * @return array Array of Escalanota objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -396,46 +259,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addEscalanota($obj1); //CHECKME - break; + $temp_obj2->addEscalanota($obj1); break; } } if ($newObject) { $obj2->initEscalanotas(); - $obj2->addEscalanota($obj1); //CHECKME - } + $obj2->addEscalanota($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EscalanotaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EscalanotaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -446,25 +296,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Escalanota objects pre-filled with all related objects. - * - * @return array Array of Escalanota objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -489,8 +331,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -501,11 +342,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addEscalanota($obj1); // CHECKME - break; + $temp_obj2->addEscalanota($obj1); break; } } @@ -519,41 +358,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return EscalanotaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Escalanota or Criteria object. - * - * @param mixed $values Criteria or Escalanota object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -561,21 +378,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Escalanota object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(EscalanotaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(EscalanotaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -586,15 +397,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Escalanota or Criteria object. - * - * @param mixed $values Criteria or Escalanota object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -604,37 +407,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(EscalanotaPeer::ID); $selectCriteria->add(EscalanotaPeer::ID, $criteria->remove(EscalanotaPeer::ID), $comparison); - } else { // $values is Escalanota object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the escalanota table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(EscalanotaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -644,17 +435,7 @@ } } - /** - * Method perform a DELETE on the database, given a Escalanota or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Escalanota object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -662,25 +443,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Escalanota) { + $criteria = clone $values; } elseif ($values instanceof Escalanota) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(EscalanotaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -691,18 +466,7 @@ } } - /** - * Validates all modified columns of given Escalanota object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Escalanota $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Escalanota $obj, $cols = null) { $columns = array(); @@ -737,13 +501,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Escalanota - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -760,14 +518,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -785,20 +536,14 @@ return $objs; } -} // BaseEscalanotaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseEscalanotaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/EscalanotaMapBuilder.php'; - Propel::registerMapBuilder('model.map.EscalanotaMapBuilder'); + require_once 'lib/model/map/EscalanotaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.EscalanotaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEspacio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEspacio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEspacio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,206 +1,113 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/EspacioPeer.php'; - -/** - * Base class that represents a row from the 'espacio' table. - * - * - * - * @package model.om - */ abstract class BaseEspacio extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var EspacioPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the m2 field. - * @var double - */ + protected $m2; - /** - * The value for the capacidad field. - * @var string - */ + protected $capacidad; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the estado field. - * @var string - */ + protected $estado; - /** - * The value for the fk_tipoespacio_id field. - * @var int - */ + protected $fk_tipoespacio_id; - /** - * The value for the fk_locacion_id field. - * @var int - */ + protected $fk_locacion_id = 0; - /** - * @var Tipoespacio - */ + protected $aTipoespacio; - /** - * @var Locacion - */ + protected $aLocacion; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [m2] column value. - * - * @return double - */ + public function getM2() { return $this->m2; } - /** - * Get the [capacidad] column value. - * - * @return string - */ + public function getCapacidad() { return $this->capacidad; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [estado] column value. - * - * @return string - */ + public function getEstado() { return $this->estado; } - /** - * Get the [fk_tipoespacio_id] column value. - * - * @return int - */ + public function getFkTipoespacioId() { return $this->fk_tipoespacio_id; } - /** - * Get the [fk_locacion_id] column value. - * - * @return int - */ + public function getFkLocacionId() { return $this->fk_locacion_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -209,14 +116,8 @@ $this->modifiedColumns[] = EspacioPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -225,14 +126,8 @@ $this->modifiedColumns[] = EspacioPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [m2] column. - * - * @param double $v new value - * @return void - */ + } + public function setM2($v) { @@ -241,14 +136,8 @@ $this->modifiedColumns[] = EspacioPeer::M2; } - } // setM2() - - /** - * Set the value of [capacidad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCapacidad($v) { @@ -257,14 +146,8 @@ $this->modifiedColumns[] = EspacioPeer::CAPACIDAD; } - } // setCapacidad() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -273,14 +156,8 @@ $this->modifiedColumns[] = EspacioPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [estado] column. - * - * @param string $v new value - * @return void - */ + } + public function setEstado($v) { @@ -289,14 +166,8 @@ $this->modifiedColumns[] = EspacioPeer::ESTADO; } - } // setEstado() - - /** - * Set the value of [fk_tipoespacio_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipoespacioId($v) { @@ -309,14 +180,8 @@ $this->aTipoespacio = null; } - } // setFkTipoespacioId() - - /** - * Set the value of [fk_locacion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkLocacionId($v) { @@ -329,21 +194,8 @@ $this->aLocacion = null; } - } // setFkLocacionId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -368,23 +220,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 8; // 8 = EspacioPeer::NUM_COLUMNS - EspacioPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 8; } catch (Exception $e) { throw new PropelException("Error populating Espacio object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -406,16 +248,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -437,29 +270,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipoespacio !== null) { if ($this->aTipoespacio->isModified()) { $affectedRows += $this->aTipoespacio->save($con); @@ -475,57 +293,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = EspacioPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += EspacioPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -538,16 +330,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -557,11 +340,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipoespacio !== null) { if (!$this->aTipoespacio->validate($columns)) { $failureMap = array_merge($failureMap, $this->aTipoespacio->getValidationFailures()); @@ -587,28 +366,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = EspacioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -639,19 +404,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = EspacioPeer::getFieldNames($keyType); @@ -668,30 +423,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = EspacioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -719,25 +458,9 @@ case 7: $this->setFkLocacionId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EspacioPeer::getFieldNames($keyType); @@ -752,11 +475,7 @@ if (array_key_exists($keys[7], $arr)) $this->setFkLocacionId($arr[$keys[7]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(EspacioPeer::DATABASE_NAME); @@ -773,14 +492,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(EspacioPeer::DATABASE_NAME); @@ -790,36 +502,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Espacio (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -840,40 +535,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Espacio Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return EspacioPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -882,13 +556,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Tipoespacio object. - * - * @param Tipoespacio $v - * @return void - * @throws PropelException - */ + public function setTipoespacio($v) { @@ -904,42 +572,21 @@ } - /** - * Get the associated Tipoespacio object - * - * @param Connection Optional Connection object. - * @return Tipoespacio The associated Tipoespacio object. - * @throws PropelException - */ + public function getTipoespacio($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipoespacioPeer.php'; + include_once 'lib/model/om/BaseTipoespacioPeer.php'; if ($this->aTipoespacio === null && ($this->fk_tipoespacio_id !== null)) { $this->aTipoespacio = TipoespacioPeer::retrieveByPK($this->fk_tipoespacio_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipoespacioPeer::retrieveByPK($this->fk_tipoespacio_id, $con); - $obj->addTipoespacios($this); - */ + } return $this->aTipoespacio; } - /** - * Declares an association between this object and a Locacion object. - * - * @param Locacion $v - * @return void - * @throws PropelException - */ + public function setLocacion($v) { @@ -955,33 +602,18 @@ } - /** - * Get the associated Locacion object - * - * @param Connection Optional Connection object. - * @return Locacion The associated Locacion object. - * @throws PropelException - */ + public function getLocacion($con = null) { - // include the related Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($this->aLocacion === null && ($this->fk_locacion_id !== null)) { $this->aLocacion = LocacionPeer::retrieveByPK($this->fk_locacion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = LocacionPeer::retrieveByPK($this->fk_locacion_id, $con); - $obj->addLocacions($this); - */ + } return $this->aLocacion; } -} // BaseEspacio +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEspacioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEspacioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEspacioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,69 +1,53 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by EspacioPeer::getOMClass() -include_once 'model/Espacio.php'; -/** - * Base static class for performing query and update operations on the 'espacio' table. - * - * - * - * @package model.om - */ abstract class BaseEspacioPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'espacio'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Espacio'; + + const CLASS_DEFAULT = 'lib.model.Espacio'; - /** The total number of columns. */ + const NUM_COLUMNS = 8; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'espacio.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'espacio.NOMBRE'; - /** the column name for the M2 field */ + const M2 = 'espacio.M2'; - /** the column name for the CAPACIDAD field */ + const CAPACIDAD = 'espacio.CAPACIDAD'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'espacio.DESCRIPCION'; - /** the column name for the ESTADO field */ + const ESTADO = 'espacio.ESTADO'; - /** the column name for the FK_TIPOESPACIO_ID field */ + const FK_TIPOESPACIO_ID = 'espacio.FK_TIPOESPACIO_ID'; - /** the column name for the FK_LOCACION_ID field */ + const FK_LOCACION_ID = 'espacio.FK_LOCACION_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'M2', 'Capacidad', 'Descripcion', 'Estado', 'FkTipoespacioId', 'FkLocacionId', ), BasePeer::TYPE_COLNAME => array (EspacioPeer::ID, EspacioPeer::NOMBRE, EspacioPeer::M2, EspacioPeer::CAPACIDAD, EspacioPeer::DESCRIPCION, EspacioPeer::ESTADO, EspacioPeer::FK_TIPOESPACIO_ID, EspacioPeer::FK_LOCACION_ID, ), @@ -71,12 +55,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'M2' => 2, 'Capacidad' => 3, 'Descripcion' => 4, 'Estado' => 5, 'FkTipoespacioId' => 6, 'FkLocacionId' => 7, ), BasePeer::TYPE_COLNAME => array (EspacioPeer::ID => 0, EspacioPeer::NOMBRE => 1, EspacioPeer::M2 => 2, EspacioPeer::CAPACIDAD => 3, EspacioPeer::DESCRIPCION => 4, EspacioPeer::ESTADO => 5, EspacioPeer::FK_TIPOESPACIO_ID => 6, EspacioPeer::FK_LOCACION_ID => 7, ), @@ -84,24 +63,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/EspacioMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.EspacioMapBuilder'); + include_once 'lib/model/map/EspacioMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.EspacioMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -115,15 +83,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -134,14 +94,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -151,34 +104,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. EspacioPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(EspacioPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -203,29 +135,19 @@ const COUNT = 'COUNT(espacio.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT espacio.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EspacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EspacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -234,19 +156,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Espacio - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -257,33 +170,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return EspacioPeer::populateObjects(EspacioPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -295,29 +187,18 @@ EspacioPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = EspacioPeer::getOMClass(); + $cls = EspacioPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -327,29 +208,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Tipoespacio table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipoespacio(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EspacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EspacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -360,35 +231,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Locacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinLocacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EspacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EspacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -399,25 +259,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Espacio objects pre-filled with their Tipoespacio objects. - * - * @return array Array of Espacio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipoespacio(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -445,37 +297,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipoespacio(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoespacio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addEspacio($obj1); //CHECKME - break; + $temp_obj2->addEspacio($obj1); break; } } if ($newObject) { $obj2->initEspacios(); - $obj2->addEspacio($obj1); //CHECKME - } + $obj2->addEspacio($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Espacio objects pre-filled with their Locacion objects. - * - * @return array Array of Espacio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinLocacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -503,46 +344,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getLocacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLocacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addEspacio($obj1); //CHECKME - break; + $temp_obj2->addEspacio($obj1); break; } } if ($newObject) { $obj2->initEspacios(); - $obj2->addEspacio($obj1); //CHECKME - } + $obj2->addEspacio($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EspacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EspacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -555,25 +383,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Espacio objects pre-filled with all related objects. - * - * @return array Array of Espacio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -603,8 +423,7 @@ $obj1->hydrate($rs); - // Add objects for joined Tipoespacio rows - + $omClass = TipoespacioPeer::getOMClass(); @@ -615,11 +434,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoespacio(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoespacio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addEspacio($obj1); // CHECKME - break; + $temp_obj2->addEspacio($obj1); break; } } @@ -629,8 +446,7 @@ } - // Add objects for joined Locacion rows - + $omClass = LocacionPeer::getOMClass(); @@ -641,11 +457,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getLocacion(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getLocacion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addEspacio($obj1); // CHECKME - break; + $temp_obj3->addEspacio($obj1); break; } } @@ -660,29 +474,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Tipoespacio table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipoespacio(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EspacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EspacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -693,35 +497,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Locacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptLocacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EspacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EspacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -732,27 +525,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Espacio objects pre-filled with all related objects except Tipoespacio. - * - * @return array Array of Espacio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipoespacio(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -786,8 +569,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getLocacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLocacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEspacio($obj1); break; @@ -805,21 +587,12 @@ } - /** - * Selects a collection of Espacio objects pre-filled with all related objects except Locacion. - * - * @return array Array of Espacio objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptLocacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -853,8 +626,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoespacio(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoespacio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEspacio($obj1); break; @@ -871,41 +643,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return EspacioPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Espacio or Criteria object. - * - * @param mixed $values Criteria or Espacio object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -913,21 +663,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Espacio object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(EspacioPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(EspacioPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -938,15 +682,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Espacio or Criteria object. - * - * @param mixed $values Criteria or Espacio object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -956,37 +692,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(EspacioPeer::ID); $selectCriteria->add(EspacioPeer::ID, $criteria->remove(EspacioPeer::ID), $comparison); - } else { // $values is Espacio object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the espacio table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(EspacioPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -996,17 +720,7 @@ } } - /** - * Method perform a DELETE on the database, given a Espacio or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Espacio object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1014,25 +728,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Espacio) { + $criteria = clone $values; } elseif ($values instanceof Espacio) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(EspacioPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1043,18 +751,7 @@ } } - /** - * Validates all modified columns of given Espacio object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Espacio $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Espacio $obj, $cols = null) { $columns = array(); @@ -1089,13 +786,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Espacio - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1112,14 +803,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1137,20 +821,14 @@ return $objs; } -} // BaseEspacioPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseEspacioPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/EspacioMapBuilder.php'; - Propel::registerMapBuilder('model.map.EspacioMapBuilder'); + require_once 'lib/model/map/EspacioMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.EspacioMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimiento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimiento.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimiento.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,295 +1,154 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/EstablecimientoPeer.php'; - -/** - * Base class that represents a row from the 'establecimiento' table. - * - * - * - * @package model.om - */ abstract class BaseEstablecimiento extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var EstablecimientoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the fk_distritoescolar_id field. - * @var int - */ + protected $fk_distritoescolar_id = 0; - /** - * The value for the fk_organizacion_id field. - * @var int - */ + protected $fk_organizacion_id = 0; - /** - * The value for the fk_niveltipo_id field. - * @var int - */ + protected $fk_niveltipo_id = 0; - /** - * @var Niveltipo - */ + protected $aNiveltipo; - /** - * @var Organizacion - */ + protected $aOrganizacion; - /** - * @var Distritoescolar - */ + protected $aDistritoescolar; - /** - * Collection to store aggregation of collRelEstablecimientoLocacions. - * @var array - */ + protected $collRelEstablecimientoLocacions; - /** - * The criteria used to select the current contents of collRelEstablecimientoLocacions. - * @var Criteria - */ + protected $lastRelEstablecimientoLocacionCriteria = null; - /** - * Collection to store aggregation of collUsuarios. - * @var array - */ + protected $collUsuarios; - /** - * The criteria used to select the current contents of collUsuarios. - * @var Criteria - */ + protected $lastUsuarioCriteria = null; - /** - * Collection to store aggregation of collAlumnos. - * @var array - */ + protected $collAlumnos; - /** - * The criteria used to select the current contents of collAlumnos. - * @var Criteria - */ + protected $lastAlumnoCriteria = null; - /** - * Collection to store aggregation of collCiclolectivos. - * @var array - */ + protected $collCiclolectivos; - /** - * The criteria used to select the current contents of collCiclolectivos. - * @var Criteria - */ + protected $lastCiclolectivoCriteria = null; - /** - * Collection to store aggregation of collConceptos. - * @var array - */ + protected $collConceptos; - /** - * The criteria used to select the current contents of collConceptos. - * @var Criteria - */ + protected $lastConceptoCriteria = null; - /** - * Collection to store aggregation of collEscalanotas. - * @var array - */ + protected $collEscalanotas; - /** - * The criteria used to select the current contents of collEscalanotas. - * @var Criteria - */ + protected $lastEscalanotaCriteria = null; - /** - * Collection to store aggregation of collAnios. - * @var array - */ + protected $collAnios; - /** - * The criteria used to select the current contents of collAnios. - * @var Criteria - */ + protected $lastAnioCriteria = null; - /** - * Collection to store aggregation of collActividads. - * @var array - */ + protected $collActividads; - /** - * The criteria used to select the current contents of collActividads. - * @var Criteria - */ + protected $lastActividadCriteria = null; - /** - * Collection to store aggregation of collRelDocenteEstablecimientos. - * @var array - */ + protected $collRelDocenteEstablecimientos; - /** - * The criteria used to select the current contents of collRelDocenteEstablecimientos. - * @var Criteria - */ + protected $lastRelDocenteEstablecimientoCriteria = null; - /** - * Collection to store aggregation of collHorarioescolars. - * @var array - */ + protected $collHorarioescolars; - /** - * The criteria used to select the current contents of collHorarioescolars. - * @var Criteria - */ + protected $lastHorarioescolarCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [fk_distritoescolar_id] column value. - * - * @return int - */ + public function getFkDistritoescolarId() { return $this->fk_distritoescolar_id; } - /** - * Get the [fk_organizacion_id] column value. - * - * @return int - */ + public function getFkOrganizacionId() { return $this->fk_organizacion_id; } - /** - * Get the [fk_niveltipo_id] column value. - * - * @return int - */ + public function getFkNiveltipoId() { return $this->fk_niveltipo_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -298,14 +157,8 @@ $this->modifiedColumns[] = EstablecimientoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -314,14 +167,8 @@ $this->modifiedColumns[] = EstablecimientoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -330,14 +177,8 @@ $this->modifiedColumns[] = EstablecimientoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [fk_distritoescolar_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDistritoescolarId($v) { @@ -350,14 +191,8 @@ $this->aDistritoescolar = null; } - } // setFkDistritoescolarId() - - /** - * Set the value of [fk_organizacion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkOrganizacionId($v) { @@ -370,14 +205,8 @@ $this->aOrganizacion = null; } - } // setFkOrganizacionId() - - /** - * Set the value of [fk_niveltipo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkNiveltipoId($v) { @@ -390,21 +219,8 @@ $this->aNiveltipo = null; } - } // setFkNiveltipoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -425,23 +241,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = EstablecimientoPeer::NUM_COLUMNS - EstablecimientoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating Establecimiento object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -463,16 +269,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -494,29 +291,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aNiveltipo !== null) { if ($this->aNiveltipo->isModified()) { $affectedRows += $this->aNiveltipo->save($con); @@ -539,22 +321,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = EstablecimientoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += EstablecimientoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelEstablecimientoLocacions !== null) { foreach($this->collRelEstablecimientoLocacions as $referrerFK) { @@ -639,37 +415,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -682,16 +438,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -701,11 +448,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aNiveltipo !== null) { if (!$this->aNiveltipo->validate($columns)) { $failureMap = array_merge($failureMap, $this->aNiveltipo->getValidationFailures()); @@ -817,28 +560,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = EstablecimientoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -863,19 +592,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = EstablecimientoPeer::getFieldNames($keyType); @@ -890,30 +609,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = EstablecimientoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -935,25 +638,9 @@ case 5: $this->setFkNiveltipoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EstablecimientoPeer::getFieldNames($keyType); @@ -966,11 +653,7 @@ if (array_key_exists($keys[5], $arr)) $this->setFkNiveltipoId($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(EstablecimientoPeer::DATABASE_NAME); @@ -985,14 +668,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(EstablecimientoPeer::DATABASE_NAME); @@ -1002,36 +678,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Establecimiento (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1047,9 +706,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelEstablecimientoLocacions() as $relObj) { $copyObj->addRelEstablecimientoLocacion($relObj->copy($deepCopy)); @@ -1091,45 +748,23 @@ $copyObj->addHorarioescolar($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Establecimiento Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return EstablecimientoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1138,13 +773,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Niveltipo object. - * - * @param Niveltipo $v - * @return void - * @throws PropelException - */ + public function setNiveltipo($v) { @@ -1160,42 +789,21 @@ } - /** - * Get the associated Niveltipo object - * - * @param Connection Optional Connection object. - * @return Niveltipo The associated Niveltipo object. - * @throws PropelException - */ + public function getNiveltipo($con = null) { - // include the related Peer class - include_once 'model/om/BaseNiveltipoPeer.php'; + include_once 'lib/model/om/BaseNiveltipoPeer.php'; if ($this->aNiveltipo === null && ($this->fk_niveltipo_id !== null)) { $this->aNiveltipo = NiveltipoPeer::retrieveByPK($this->fk_niveltipo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = NiveltipoPeer::retrieveByPK($this->fk_niveltipo_id, $con); - $obj->addNiveltipos($this); - */ + } return $this->aNiveltipo; } - /** - * Declares an association between this object and a Organizacion object. - * - * @param Organizacion $v - * @return void - * @throws PropelException - */ + public function setOrganizacion($v) { @@ -1211,42 +819,21 @@ } - /** - * Get the associated Organizacion object - * - * @param Connection Optional Connection object. - * @return Organizacion The associated Organizacion object. - * @throws PropelException - */ + public function getOrganizacion($con = null) { - // include the related Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($this->aOrganizacion === null && ($this->fk_organizacion_id !== null)) { $this->aOrganizacion = OrganizacionPeer::retrieveByPK($this->fk_organizacion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = OrganizacionPeer::retrieveByPK($this->fk_organizacion_id, $con); - $obj->addOrganizacions($this); - */ + } return $this->aOrganizacion; } - /** - * Declares an association between this object and a Distritoescolar object. - * - * @param Distritoescolar $v - * @return void - * @throws PropelException - */ + public function setDistritoescolar($v) { @@ -1262,41 +849,21 @@ } - /** - * Get the associated Distritoescolar object - * - * @param Connection Optional Connection object. - * @return Distritoescolar The associated Distritoescolar object. - * @throws PropelException - */ + public function getDistritoescolar($con = null) { - // include the related Peer class - include_once 'model/om/BaseDistritoescolarPeer.php'; + include_once 'lib/model/om/BaseDistritoescolarPeer.php'; if ($this->aDistritoescolar === null && ($this->fk_distritoescolar_id !== null)) { $this->aDistritoescolar = DistritoescolarPeer::retrieveByPK($this->fk_distritoescolar_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DistritoescolarPeer::retrieveByPK($this->fk_distritoescolar_id, $con); - $obj->addDistritoescolars($this); - */ + } return $this->aDistritoescolar; } - /** - * Temporary storage of collRelEstablecimientoLocacions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelEstablecimientoLocacions() { if ($this->collRelEstablecimientoLocacions === null) { @@ -1304,23 +871,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related RelEstablecimientoLocacions from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelEstablecimientoLocacions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + include_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1340,13 +894,9 @@ $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); RelEstablecimientoLocacionPeer::addSelectColumns($criteria); @@ -1359,18 +909,10 @@ return $this->collRelEstablecimientoLocacions; } - /** - * Returns the number of related RelEstablecimientoLocacions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelEstablecimientoLocacions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + include_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1384,14 +926,7 @@ return RelEstablecimientoLocacionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelEstablecimientoLocacion object to this object - * through the RelEstablecimientoLocacion foreign key attribute - * - * @param RelEstablecimientoLocacion $l RelEstablecimientoLocacion - * @return void - * @throws PropelException - */ + public function addRelEstablecimientoLocacion(RelEstablecimientoLocacion $l) { $this->collRelEstablecimientoLocacions[] = $l; @@ -1399,21 +934,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related RelEstablecimientoLocacions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getRelEstablecimientoLocacionsJoinLocacion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + include_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1432,10 +956,7 @@ $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelectJoinLocacion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastRelEstablecimientoLocacionCriteria) || !$this->lastRelEstablecimientoLocacionCriteria->equals($criteria)) { @@ -1447,12 +968,7 @@ return $this->collRelEstablecimientoLocacions; } - /** - * Temporary storage of collUsuarios to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initUsuarios() { if ($this->collUsuarios === null) { @@ -1460,23 +976,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Usuarios from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getUsuarios($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseUsuarioPeer.php'; + include_once 'lib/model/om/BaseUsuarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1496,13 +999,9 @@ $this->collUsuarios = UsuarioPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(UsuarioPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); UsuarioPeer::addSelectColumns($criteria); @@ -1515,18 +1014,10 @@ return $this->collUsuarios; } - /** - * Returns the number of related Usuarios. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countUsuarios($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseUsuarioPeer.php'; + include_once 'lib/model/om/BaseUsuarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1540,26 +1031,14 @@ return UsuarioPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Usuario object to this object - * through the Usuario foreign key attribute - * - * @param Usuario $l Usuario - * @return void - * @throws PropelException - */ + public function addUsuario(Usuario $l) { $this->collUsuarios[] = $l; $l->setEstablecimiento($this); } - /** - * Temporary storage of collAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAlumnos() { if ($this->collAlumnos === null) { @@ -1567,23 +1046,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Alumnos from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1603,13 +1069,9 @@ $this->collAlumnos = AlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); AlumnoPeer::addSelectColumns($criteria); @@ -1622,18 +1084,10 @@ return $this->collAlumnos; } - /** - * Returns the number of related Alumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1647,14 +1101,7 @@ return AlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Alumno object to this object - * through the Alumno foreign key attribute - * - * @param Alumno $l Alumno - * @return void - * @throws PropelException - */ + public function addAlumno(Alumno $l) { $this->collAlumnos[] = $l; @@ -1662,21 +1109,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getAlumnosJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1695,10 +1131,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1711,21 +1144,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getAlumnosJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1744,10 +1166,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1760,21 +1179,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getAlumnosJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1793,10 +1201,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1809,21 +1214,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getAlumnosJoinConceptobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1842,10 +1236,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinConceptobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1858,21 +1249,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getAlumnosJoinPais($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1891,10 +1271,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinPais($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1906,12 +1283,7 @@ return $this->collAlumnos; } - /** - * Temporary storage of collCiclolectivos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initCiclolectivos() { if ($this->collCiclolectivos === null) { @@ -1919,23 +1291,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Ciclolectivos from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getCiclolectivos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseCiclolectivoPeer.php'; + include_once 'lib/model/om/BaseCiclolectivoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1955,13 +1314,9 @@ $this->collCiclolectivos = CiclolectivoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); CiclolectivoPeer::addSelectColumns($criteria); @@ -1974,18 +1329,10 @@ return $this->collCiclolectivos; } - /** - * Returns the number of related Ciclolectivos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countCiclolectivos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseCiclolectivoPeer.php'; + include_once 'lib/model/om/BaseCiclolectivoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1999,26 +1346,14 @@ return CiclolectivoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Ciclolectivo object to this object - * through the Ciclolectivo foreign key attribute - * - * @param Ciclolectivo $l Ciclolectivo - * @return void - * @throws PropelException - */ + public function addCiclolectivo(Ciclolectivo $l) { $this->collCiclolectivos[] = $l; $l->setEstablecimiento($this); } - /** - * Temporary storage of collConceptos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initConceptos() { if ($this->collConceptos === null) { @@ -2026,23 +1361,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Conceptos from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getConceptos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseConceptoPeer.php'; + include_once 'lib/model/om/BaseConceptoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2062,13 +1384,9 @@ $this->collConceptos = ConceptoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ConceptoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); ConceptoPeer::addSelectColumns($criteria); @@ -2081,18 +1399,10 @@ return $this->collConceptos; } - /** - * Returns the number of related Conceptos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countConceptos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseConceptoPeer.php'; + include_once 'lib/model/om/BaseConceptoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2106,26 +1416,14 @@ return ConceptoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Concepto object to this object - * through the Concepto foreign key attribute - * - * @param Concepto $l Concepto - * @return void - * @throws PropelException - */ + public function addConcepto(Concepto $l) { $this->collConceptos[] = $l; $l->setEstablecimiento($this); } - /** - * Temporary storage of collEscalanotas to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initEscalanotas() { if ($this->collEscalanotas === null) { @@ -2133,23 +1431,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Escalanotas from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getEscalanotas($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEscalanotaPeer.php'; + include_once 'lib/model/om/BaseEscalanotaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2169,13 +1454,9 @@ $this->collEscalanotas = EscalanotaPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(EscalanotaPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); EscalanotaPeer::addSelectColumns($criteria); @@ -2188,18 +1469,10 @@ return $this->collEscalanotas; } - /** - * Returns the number of related Escalanotas. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countEscalanotas($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseEscalanotaPeer.php'; + include_once 'lib/model/om/BaseEscalanotaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2213,26 +1486,14 @@ return EscalanotaPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Escalanota object to this object - * through the Escalanota foreign key attribute - * - * @param Escalanota $l Escalanota - * @return void - * @throws PropelException - */ + public function addEscalanota(Escalanota $l) { $this->collEscalanotas[] = $l; $l->setEstablecimiento($this); } - /** - * Temporary storage of collAnios to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAnios() { if ($this->collAnios === null) { @@ -2240,23 +1501,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Anios from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAnios($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAnioPeer.php'; + include_once 'lib/model/om/BaseAnioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2276,13 +1524,9 @@ $this->collAnios = AnioPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AnioPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); AnioPeer::addSelectColumns($criteria); @@ -2295,18 +1539,10 @@ return $this->collAnios; } - /** - * Returns the number of related Anios. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAnios($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAnioPeer.php'; + include_once 'lib/model/om/BaseAnioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2320,26 +1556,14 @@ return AnioPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Anio object to this object - * through the Anio foreign key attribute - * - * @param Anio $l Anio - * @return void - * @throws PropelException - */ + public function addAnio(Anio $l) { $this->collAnios[] = $l; $l->setEstablecimiento($this); } - /** - * Temporary storage of collActividads to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initActividads() { if ($this->collActividads === null) { @@ -2347,23 +1571,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Actividads from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getActividads($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2383,13 +1594,9 @@ $this->collActividads = ActividadPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ActividadPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); ActividadPeer::addSelectColumns($criteria); @@ -2402,18 +1609,10 @@ return $this->collActividads; } - /** - * Returns the number of related Actividads. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countActividads($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2427,26 +1626,14 @@ return ActividadPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Actividad object to this object - * through the Actividad foreign key attribute - * - * @param Actividad $l Actividad - * @return void - * @throws PropelException - */ + public function addActividad(Actividad $l) { $this->collActividads[] = $l; $l->setEstablecimiento($this); } - /** - * Temporary storage of collRelDocenteEstablecimientos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDocenteEstablecimientos() { if ($this->collRelDocenteEstablecimientos === null) { @@ -2454,23 +1641,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related RelDocenteEstablecimientos from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDocenteEstablecimientos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2490,13 +1664,9 @@ $this->collRelDocenteEstablecimientos = RelDocenteEstablecimientoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDocenteEstablecimientoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); RelDocenteEstablecimientoPeer::addSelectColumns($criteria); @@ -2509,18 +1679,10 @@ return $this->collRelDocenteEstablecimientos; } - /** - * Returns the number of related RelDocenteEstablecimientos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDocenteEstablecimientos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2534,14 +1696,7 @@ return RelDocenteEstablecimientoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDocenteEstablecimiento object to this object - * through the RelDocenteEstablecimiento foreign key attribute - * - * @param RelDocenteEstablecimiento $l RelDocenteEstablecimiento - * @return void - * @throws PropelException - */ + public function addRelDocenteEstablecimiento(RelDocenteEstablecimiento $l) { $this->collRelDocenteEstablecimientos[] = $l; @@ -2549,21 +1704,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related RelDocenteEstablecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getRelDocenteEstablecimientosJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDocenteEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseRelDocenteEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2582,10 +1726,7 @@ $this->collRelDocenteEstablecimientos = RelDocenteEstablecimientoPeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDocenteEstablecimientoPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastRelDocenteEstablecimientoCriteria) || !$this->lastRelDocenteEstablecimientoCriteria->equals($criteria)) { @@ -2597,12 +1738,7 @@ return $this->collRelDocenteEstablecimientos; } - /** - * Temporary storage of collHorarioescolars to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initHorarioescolars() { if ($this->collHorarioescolars === null) { @@ -2610,23 +1746,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento has previously - * been saved, it will retrieve related Horarioescolars from storage. - * If this Establecimiento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getHorarioescolars($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2646,13 +1769,9 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(HorarioescolarPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); HorarioescolarPeer::addSelectColumns($criteria); @@ -2665,18 +1784,10 @@ return $this->collHorarioescolars; } - /** - * Returns the number of related Horarioescolars. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countHorarioescolars($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2690,14 +1801,7 @@ return HorarioescolarPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Horarioescolar object to this object - * through the Horarioescolar foreign key attribute - * - * @param Horarioescolar $l Horarioescolar - * @return void - * @throws PropelException - */ + public function addHorarioescolar(Horarioescolar $l) { $this->collHorarioescolars[] = $l; @@ -2705,21 +1809,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Horarioescolars from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getHorarioescolarsJoinHorarioescolartipo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2738,10 +1831,7 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelectJoinHorarioescolartipo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(HorarioescolarPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastHorarioescolarCriteria) || !$this->lastHorarioescolarCriteria->equals($criteria)) { @@ -2754,21 +1844,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Establecimiento is new, it will return - * an empty collection; or if this Establecimiento has previously - * been saved, it will retrieve related Horarioescolars from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Establecimiento. - */ + public function getHorarioescolarsJoinTurnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2787,10 +1866,7 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelectJoinTurnos($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(HorarioescolarPeer::FK_ESTABLECIMIENTO_ID, $this->getId()); if (!isset($this->lastHorarioescolarCriteria) || !$this->lastHorarioescolarCriteria->equals($criteria)) { @@ -2802,4 +1878,4 @@ return $this->collHorarioescolars; } -} // BaseEstablecimiento +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimientoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimientoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEstablecimientoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by EstablecimientoPeer::getOMClass() -include_once 'model/Establecimiento.php'; -/** - * Base static class for performing query and update operations on the 'establecimiento' table. - * - * - * - * @package model.om - */ abstract class BaseEstablecimientoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'establecimiento'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Establecimiento'; + + const CLASS_DEFAULT = 'lib.model.Establecimiento'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'establecimiento.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'establecimiento.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'establecimiento.DESCRIPCION'; - /** the column name for the FK_DISTRITOESCOLAR_ID field */ + const FK_DISTRITOESCOLAR_ID = 'establecimiento.FK_DISTRITOESCOLAR_ID'; - /** the column name for the FK_ORGANIZACION_ID field */ + const FK_ORGANIZACION_ID = 'establecimiento.FK_ORGANIZACION_ID'; - /** the column name for the FK_NIVELTIPO_ID field */ + const FK_NIVELTIPO_ID = 'establecimiento.FK_NIVELTIPO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'FkDistritoescolarId', 'FkOrganizacionId', 'FkNiveltipoId', ), BasePeer::TYPE_COLNAME => array (EstablecimientoPeer::ID, EstablecimientoPeer::NOMBRE, EstablecimientoPeer::DESCRIPCION, EstablecimientoPeer::FK_DISTRITOESCOLAR_ID, EstablecimientoPeer::FK_ORGANIZACION_ID, EstablecimientoPeer::FK_NIVELTIPO_ID, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'FkDistritoescolarId' => 3, 'FkOrganizacionId' => 4, 'FkNiveltipoId' => 5, ), BasePeer::TYPE_COLNAME => array (EstablecimientoPeer::ID => 0, EstablecimientoPeer::NOMBRE => 1, EstablecimientoPeer::DESCRIPCION => 2, EstablecimientoPeer::FK_DISTRITOESCOLAR_ID => 3, EstablecimientoPeer::FK_ORGANIZACION_ID => 4, EstablecimientoPeer::FK_NIVELTIPO_ID => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/EstablecimientoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.EstablecimientoMapBuilder'); + include_once 'lib/model/map/EstablecimientoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.EstablecimientoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. EstablecimientoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(EstablecimientoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(establecimiento.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT establecimiento.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Establecimiento - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return EstablecimientoPeer::populateObjects(EstablecimientoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ EstablecimientoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = EstablecimientoPeer::getOMClass(); + $cls = EstablecimientoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -317,29 +198,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Niveltipo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinNiveltipo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -350,35 +221,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Organizacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinOrganizacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -389,35 +249,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Distritoescolar table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDistritoescolar(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -428,25 +277,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Establecimiento objects pre-filled with their Niveltipo objects. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinNiveltipo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -474,37 +315,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getNiveltipo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getNiveltipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addEstablecimiento($obj1); //CHECKME - break; + $temp_obj2->addEstablecimiento($obj1); break; } } if ($newObject) { $obj2->initEstablecimientos(); - $obj2->addEstablecimiento($obj1); //CHECKME - } + $obj2->addEstablecimiento($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Establecimiento objects pre-filled with their Organizacion objects. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinOrganizacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -532,37 +362,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getOrganizacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getOrganizacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addEstablecimiento($obj1); //CHECKME - break; + $temp_obj2->addEstablecimiento($obj1); break; } } if ($newObject) { $obj2->initEstablecimientos(); - $obj2->addEstablecimiento($obj1); //CHECKME - } + $obj2->addEstablecimiento($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Establecimiento objects pre-filled with their Distritoescolar objects. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDistritoescolar(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -590,46 +409,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDistritoescolar(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDistritoescolar(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addEstablecimiento($obj1); //CHECKME - break; + $temp_obj2->addEstablecimiento($obj1); break; } } if ($newObject) { $obj2->initEstablecimientos(); - $obj2->addEstablecimiento($obj1); //CHECKME - } + $obj2->addEstablecimiento($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -644,25 +450,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Establecimiento objects pre-filled with all related objects. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -697,8 +495,7 @@ $obj1->hydrate($rs); - // Add objects for joined Niveltipo rows - + $omClass = NiveltipoPeer::getOMClass(); @@ -709,11 +506,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getNiveltipo(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getNiveltipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addEstablecimiento($obj1); // CHECKME - break; + $temp_obj2->addEstablecimiento($obj1); break; } } @@ -723,8 +518,7 @@ } - // Add objects for joined Organizacion rows - + $omClass = OrganizacionPeer::getOMClass(); @@ -735,11 +529,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getOrganizacion(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getOrganizacion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addEstablecimiento($obj1); // CHECKME - break; + $temp_obj3->addEstablecimiento($obj1); break; } } @@ -749,8 +541,7 @@ } - // Add objects for joined Distritoescolar rows - + $omClass = DistritoescolarPeer::getOMClass(); @@ -761,11 +552,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getDistritoescolar(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getDistritoescolar(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addEstablecimiento($obj1); // CHECKME - break; + $temp_obj4->addEstablecimiento($obj1); break; } } @@ -780,29 +569,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Niveltipo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptNiveltipo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -815,35 +594,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Organizacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptOrganizacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -856,35 +624,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Distritoescolar table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDistritoescolar(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(EstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(EstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -897,27 +654,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Establecimiento objects pre-filled with all related objects except Niveltipo. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptNiveltipo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -956,8 +703,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getOrganizacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getOrganizacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEstablecimiento($obj1); break; @@ -979,8 +725,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getDistritoescolar(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getDistritoescolar(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addEstablecimiento($obj1); break; @@ -998,21 +743,12 @@ } - /** - * Selects a collection of Establecimiento objects pre-filled with all related objects except Organizacion. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptOrganizacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1051,8 +787,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getNiveltipo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getNiveltipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEstablecimiento($obj1); break; @@ -1074,8 +809,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getDistritoescolar(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getDistritoescolar(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addEstablecimiento($obj1); break; @@ -1093,21 +827,12 @@ } - /** - * Selects a collection of Establecimiento objects pre-filled with all related objects except Distritoescolar. - * - * @return array Array of Establecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDistritoescolar(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1146,8 +871,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getNiveltipo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getNiveltipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEstablecimiento($obj1); break; @@ -1169,8 +893,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getOrganizacion(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getOrganizacion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addEstablecimiento($obj1); break; @@ -1187,41 +910,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return EstablecimientoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Establecimiento or Criteria object. - * - * @param mixed $values Criteria or Establecimiento object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1229,21 +930,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Establecimiento object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(EstablecimientoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(EstablecimientoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1254,15 +949,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Establecimiento or Criteria object. - * - * @param mixed $values Criteria or Establecimiento object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1272,37 +959,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(EstablecimientoPeer::ID); $selectCriteria->add(EstablecimientoPeer::ID, $criteria->remove(EstablecimientoPeer::ID), $comparison); - } else { // $values is Establecimiento object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the establecimiento table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(EstablecimientoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1312,17 +987,7 @@ } } - /** - * Method perform a DELETE on the database, given a Establecimiento or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Establecimiento object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1330,25 +995,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Establecimiento) { + $criteria = clone $values; } elseif ($values instanceof Establecimiento) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(EstablecimientoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1359,18 +1018,7 @@ } } - /** - * Validates all modified columns of given Establecimiento object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Establecimiento $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Establecimiento $obj, $cols = null) { $columns = array(); @@ -1405,13 +1053,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Establecimiento - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1428,14 +1070,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1453,20 +1088,14 @@ return $objs; } -} // BaseEstablecimientoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseEstablecimientoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/EstablecimientoMapBuilder.php'; - Propel::registerMapBuilder('model.map.EstablecimientoMapBuilder'); + require_once 'lib/model/map/EstablecimientoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.EstablecimientoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseExamen.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseExamen.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseExamen.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,220 +1,120 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - -include_once 'creole/util/Clob.php'; -include_once 'creole/util/Blob.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ExamenPeer.php'; - -/** - * Base class that represents a row from the 'examen' table. - * - * - * - * @package model.om - */ abstract class BaseExamen extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ExamenPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_escalanota_id field. - * @var int - */ + protected $fk_escalanota_id = 0; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id = 0; - /** - * The value for the fk_actividad_id field. - * @var int - */ + protected $fk_actividad_id = 0; - /** - * The value for the fk_periodo_id field. - * @var int - */ + protected $fk_periodo_id = 0; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the observacion field. - * @var string - */ + protected $observacion; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * @var Escalanota - */ + protected $aEscalanota; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * @var Actividad - */ + protected $aActividad; - /** - * @var Periodo - */ + protected $aPeriodo; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_escalanota_id] column value. - * - * @return int - */ + public function getFkEscalanotaId() { return $this->fk_escalanota_id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Get the [fk_actividad_id] column value. - * - * @return int - */ + public function getFkActividadId() { return $this->fk_actividad_id; } - /** - * Get the [fk_periodo_id] column value. - * - * @return int - */ + public function getFkPeriodoId() { return $this->fk_periodo_id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [observacion] column value. - * - * @return string - */ + public function getObservacion() { return $this->observacion; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -228,12 +128,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -242,14 +137,8 @@ $this->modifiedColumns[] = ExamenPeer::ID; } - } // setId() - - /** - * Set the value of [fk_escalanota_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEscalanotaId($v) { @@ -262,14 +151,8 @@ $this->aEscalanota = null; } - } // setFkEscalanotaId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -282,14 +165,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Set the value of [fk_actividad_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkActividadId($v) { @@ -302,14 +179,8 @@ $this->aActividad = null; } - } // setFkActividadId() - - /** - * Set the value of [fk_periodo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPeriodoId($v) { @@ -322,14 +193,8 @@ $this->aPeriodo = null; } - } // setFkPeriodoId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -338,21 +203,12 @@ $this->modifiedColumns[] = ExamenPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [observacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setObservacion($v) { - // if the passed in parameter is the *same* object that - // is stored internally then we use the Lob->isModified() - // method to know whether contents changed. - if ($v instanceof Lob && $v === $this->observacion) { + if ($v instanceof Lob && $v === $this->observacion) { $changed = $v->isModified(); } else { $changed = ($this->observacion !== $v); @@ -368,21 +224,14 @@ $this->modifiedColumns[] = ExamenPeer::OBSERVACION; } - } // setObservacion() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -392,21 +241,8 @@ $this->modifiedColumns[] = ExamenPeer::FECHA; } - } // setFecha() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -431,23 +267,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 8; // 8 = ExamenPeer::NUM_COLUMNS - ExamenPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 8; } catch (Exception $e) { throw new PropelException("Error populating Examen object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -469,16 +295,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -500,29 +317,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEscalanota !== null) { if ($this->aEscalanota->isModified()) { $affectedRows += $this->aEscalanota->save($con); @@ -552,57 +354,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ExamenPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ExamenPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -615,16 +391,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -634,11 +401,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEscalanota !== null) { if (!$this->aEscalanota->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEscalanota->getValidationFailures()); @@ -676,28 +439,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ExamenPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -728,19 +477,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ExamenPeer::getFieldNames($keyType); @@ -757,30 +496,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ExamenPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -808,25 +531,9 @@ case 7: $this->setFecha($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ExamenPeer::getFieldNames($keyType); @@ -841,11 +548,7 @@ if (array_key_exists($keys[7], $arr)) $this->setFecha($arr[$keys[7]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ExamenPeer::DATABASE_NAME); @@ -862,14 +565,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ExamenPeer::DATABASE_NAME); @@ -879,36 +575,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Examen (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -929,40 +608,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Examen Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ExamenPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -971,13 +629,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Escalanota object. - * - * @param Escalanota $v - * @return void - * @throws PropelException - */ + public function setEscalanota($v) { @@ -993,42 +645,21 @@ } - /** - * Get the associated Escalanota object - * - * @param Connection Optional Connection object. - * @return Escalanota The associated Escalanota object. - * @throws PropelException - */ + public function getEscalanota($con = null) { - // include the related Peer class - include_once 'model/om/BaseEscalanotaPeer.php'; + include_once 'lib/model/om/BaseEscalanotaPeer.php'; if ($this->aEscalanota === null && ($this->fk_escalanota_id !== null)) { $this->aEscalanota = EscalanotaPeer::retrieveByPK($this->fk_escalanota_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EscalanotaPeer::retrieveByPK($this->fk_escalanota_id, $con); - $obj->addEscalanotas($this); - */ + } return $this->aEscalanota; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -1044,42 +675,21 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } - /** - * Declares an association between this object and a Actividad object. - * - * @param Actividad $v - * @return void - * @throws PropelException - */ + public function setActividad($v) { @@ -1095,42 +705,21 @@ } - /** - * Get the associated Actividad object - * - * @param Connection Optional Connection object. - * @return Actividad The associated Actividad object. - * @throws PropelException - */ + public function getActividad($con = null) { - // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { $this->aActividad = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - $obj->addActividads($this); - */ + } return $this->aActividad; } - /** - * Declares an association between this object and a Periodo object. - * - * @param Periodo $v - * @return void - * @throws PropelException - */ + public function setPeriodo($v) { @@ -1146,33 +735,18 @@ } - /** - * Get the associated Periodo object - * - * @param Connection Optional Connection object. - * @return Periodo The associated Periodo object. - * @throws PropelException - */ + public function getPeriodo($con = null) { - // include the related Peer class - include_once 'model/om/BasePeriodoPeer.php'; + include_once 'lib/model/om/BasePeriodoPeer.php'; if ($this->aPeriodo === null && ($this->fk_periodo_id !== null)) { $this->aPeriodo = PeriodoPeer::retrieveByPK($this->fk_periodo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PeriodoPeer::retrieveByPK($this->fk_periodo_id, $con); - $obj->addPeriodos($this); - */ + } return $this->aPeriodo; } -} // BaseExamen +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseExamenPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseExamenPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseExamenPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,69 +1,53 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ExamenPeer::getOMClass() -include_once 'model/Examen.php'; -/** - * Base static class for performing query and update operations on the 'examen' table. - * - * - * - * @package model.om - */ abstract class BaseExamenPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'examen'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Examen'; + + const CLASS_DEFAULT = 'lib.model.Examen'; - /** The total number of columns. */ + const NUM_COLUMNS = 8; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'examen.ID'; - /** the column name for the FK_ESCALANOTA_ID field */ + const FK_ESCALANOTA_ID = 'examen.FK_ESCALANOTA_ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'examen.FK_ALUMNO_ID'; - /** the column name for the FK_ACTIVIDAD_ID field */ + const FK_ACTIVIDAD_ID = 'examen.FK_ACTIVIDAD_ID'; - /** the column name for the FK_PERIODO_ID field */ + const FK_PERIODO_ID = 'examen.FK_PERIODO_ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'examen.NOMBRE'; - /** the column name for the OBSERVACION field */ + const OBSERVACION = 'examen.OBSERVACION'; - /** the column name for the FECHA field */ + const FECHA = 'examen.FECHA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEscalanotaId', 'FkAlumnoId', 'FkActividadId', 'FkPeriodoId', 'Nombre', 'Observacion', 'Fecha', ), BasePeer::TYPE_COLNAME => array (ExamenPeer::ID, ExamenPeer::FK_ESCALANOTA_ID, ExamenPeer::FK_ALUMNO_ID, ExamenPeer::FK_ACTIVIDAD_ID, ExamenPeer::FK_PERIODO_ID, ExamenPeer::NOMBRE, ExamenPeer::OBSERVACION, ExamenPeer::FECHA, ), @@ -71,12 +55,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEscalanotaId' => 1, 'FkAlumnoId' => 2, 'FkActividadId' => 3, 'FkPeriodoId' => 4, 'Nombre' => 5, 'Observacion' => 6, 'Fecha' => 7, ), BasePeer::TYPE_COLNAME => array (ExamenPeer::ID => 0, ExamenPeer::FK_ESCALANOTA_ID => 1, ExamenPeer::FK_ALUMNO_ID => 2, ExamenPeer::FK_ACTIVIDAD_ID => 3, ExamenPeer::FK_PERIODO_ID => 4, ExamenPeer::NOMBRE => 5, ExamenPeer::OBSERVACION => 6, ExamenPeer::FECHA => 7, ), @@ -84,24 +63,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ExamenMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ExamenMapBuilder'); + include_once 'lib/model/map/ExamenMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ExamenMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -115,15 +83,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -134,14 +94,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -151,34 +104,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ExamenPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ExamenPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -203,29 +135,19 @@ const COUNT = 'COUNT(examen.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT examen.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -234,19 +156,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Examen - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -257,33 +170,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ExamenPeer::populateObjects(ExamenPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -295,29 +187,18 @@ ExamenPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ExamenPeer::getOMClass(); + $cls = ExamenPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -327,29 +208,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Escalanota table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEscalanota(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -360,35 +231,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -399,35 +259,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -438,35 +287,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Periodo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPeriodo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -477,25 +315,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Examen objects pre-filled with their Escalanota objects. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEscalanota(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -523,37 +353,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addExamen($obj1); //CHECKME - break; + $temp_obj2->addExamen($obj1); break; } } if ($newObject) { $obj2->initExamens(); - $obj2->addExamen($obj1); //CHECKME - } + $obj2->addExamen($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Examen objects pre-filled with their Alumno objects. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -581,37 +400,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addExamen($obj1); //CHECKME - break; + $temp_obj2->addExamen($obj1); break; } } if ($newObject) { $obj2->initExamens(); - $obj2->addExamen($obj1); //CHECKME - } + $obj2->addExamen($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Examen objects pre-filled with their Actividad objects. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -639,37 +447,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addExamen($obj1); //CHECKME - break; + $temp_obj2->addExamen($obj1); break; } } if ($newObject) { $obj2->initExamens(); - $obj2->addExamen($obj1); //CHECKME - } + $obj2->addExamen($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Examen objects pre-filled with their Periodo objects. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPeriodo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -697,46 +494,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPeriodo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addExamen($obj1); //CHECKME - break; + $temp_obj2->addExamen($obj1); break; } } if ($newObject) { $obj2->initExamens(); - $obj2->addExamen($obj1); //CHECKME - } + $obj2->addExamen($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -753,25 +537,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Examen objects pre-filled with all related objects. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -811,8 +587,7 @@ $obj1->hydrate($rs); - // Add objects for joined Escalanota rows - + $omClass = EscalanotaPeer::getOMClass(); @@ -823,11 +598,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addExamen($obj1); // CHECKME - break; + $temp_obj2->addExamen($obj1); break; } } @@ -837,8 +610,7 @@ } - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -849,11 +621,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addExamen($obj1); // CHECKME - break; + $temp_obj3->addExamen($obj1); break; } } @@ -863,8 +633,7 @@ } - // Add objects for joined Actividad rows - + $omClass = ActividadPeer::getOMClass(); @@ -875,11 +644,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getActividad(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getActividad(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addExamen($obj1); // CHECKME - break; + $temp_obj4->addExamen($obj1); break; } } @@ -889,8 +656,7 @@ } - // Add objects for joined Periodo rows - + $omClass = PeriodoPeer::getOMClass(); @@ -901,11 +667,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getPeriodo(); // CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getPeriodo(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; - $temp_obj5->addExamen($obj1); // CHECKME - break; + $temp_obj5->addExamen($obj1); break; } } @@ -920,29 +684,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Escalanota table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEscalanota(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -957,35 +711,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1000,35 +743,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1043,35 +775,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Periodo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptPeriodo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ExamenPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ExamenPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1086,27 +807,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Examen objects pre-filled with all related objects except Escalanota. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEscalanota(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1150,8 +861,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addExamen($obj1); break; @@ -1173,8 +883,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getActividad(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addExamen($obj1); break; @@ -1196,8 +905,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addExamen($obj1); break; @@ -1215,21 +923,12 @@ } - /** - * Selects a collection of Examen objects pre-filled with all related objects except Alumno. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1273,8 +972,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addExamen($obj1); break; @@ -1296,8 +994,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getActividad(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addExamen($obj1); break; @@ -1319,8 +1016,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addExamen($obj1); break; @@ -1338,21 +1034,12 @@ } - /** - * Selects a collection of Examen objects pre-filled with all related objects except Actividad. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1396,8 +1083,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addExamen($obj1); break; @@ -1419,8 +1105,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addExamen($obj1); break; @@ -1442,8 +1127,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getPeriodo(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getPeriodo(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addExamen($obj1); break; @@ -1461,21 +1145,12 @@ } - /** - * Selects a collection of Examen objects pre-filled with all related objects except Periodo. - * - * @return array Array of Examen objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptPeriodo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1519,8 +1194,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEscalanota(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEscalanota(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addExamen($obj1); break; @@ -1542,8 +1216,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addExamen($obj1); break; @@ -1565,8 +1238,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getActividad(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addExamen($obj1); break; @@ -1583,41 +1255,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ExamenPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Examen or Criteria object. - * - * @param mixed $values Criteria or Examen object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1625,21 +1275,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Examen object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ExamenPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ExamenPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1650,15 +1294,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Examen or Criteria object. - * - * @param mixed $values Criteria or Examen object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1668,37 +1304,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ExamenPeer::ID); $selectCriteria->add(ExamenPeer::ID, $criteria->remove(ExamenPeer::ID), $comparison); - } else { // $values is Examen object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the examen table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ExamenPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1708,17 +1332,7 @@ } } - /** - * Method perform a DELETE on the database, given a Examen or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Examen object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1726,25 +1340,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Examen) { + $criteria = clone $values; } elseif ($values instanceof Examen) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ExamenPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1755,18 +1363,7 @@ } } - /** - * Validates all modified columns of given Examen object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Examen $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Examen $obj, $cols = null) { $columns = array(); @@ -1801,13 +1398,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Examen - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1824,14 +1415,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1849,20 +1433,14 @@ return $objs; } -} // BaseExamenPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseExamenPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ExamenMapBuilder.php'; - Propel::registerMapBuilder('model.map.ExamenMapBuilder'); + require_once 'lib/model/map/ExamenMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ExamenMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseFeriado.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseFeriado.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseFeriado.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,133 +1,68 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/FeriadoPeer.php'; - -/** - * Base class that represents a row from the 'feriado' table. - * - * - * - * @package model.om - */ abstract class BaseFeriado extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var FeriadoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * The value for the repeticion_anual field. - * @var boolean - */ + protected $repeticion_anual = true; - /** - * The value for the inamovible field. - * @var boolean - */ + protected $inamovible = true; - /** - * The value for the fk_ciclolectivo_id field. - * @var int - */ + protected $fk_ciclolectivo_id = 0; - /** - * @var Ciclolectivo - */ + protected $aCiclolectivo; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -141,45 +76,28 @@ } } - /** - * Get the [repeticion_anual] column value. - * - * @return boolean - */ + public function getRepeticionAnual() { return $this->repeticion_anual; } - /** - * Get the [inamovible] column value. - * - * @return boolean - */ + public function getInamovible() { return $this->inamovible; } - /** - * Get the [fk_ciclolectivo_id] column value. - * - * @return int - */ + public function getFkCiclolectivoId() { return $this->fk_ciclolectivo_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -188,14 +106,8 @@ $this->modifiedColumns[] = FeriadoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -204,21 +116,14 @@ $this->modifiedColumns[] = FeriadoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -228,14 +133,8 @@ $this->modifiedColumns[] = FeriadoPeer::FECHA; } - } // setFecha() - - /** - * Set the value of [repeticion_anual] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setRepeticionAnual($v) { @@ -244,14 +143,8 @@ $this->modifiedColumns[] = FeriadoPeer::REPETICION_ANUAL; } - } // setRepeticionAnual() - - /** - * Set the value of [inamovible] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setInamovible($v) { @@ -260,14 +153,8 @@ $this->modifiedColumns[] = FeriadoPeer::INAMOVIBLE; } - } // setInamovible() - - /** - * Set the value of [fk_ciclolectivo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCiclolectivoId($v) { @@ -280,21 +167,8 @@ $this->aCiclolectivo = null; } - } // setFkCiclolectivoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -315,23 +189,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = FeriadoPeer::NUM_COLUMNS - FeriadoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating Feriado object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -353,16 +217,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -384,29 +239,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCiclolectivo !== null) { if ($this->aCiclolectivo->isModified()) { $affectedRows += $this->aCiclolectivo->save($con); @@ -415,57 +255,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = FeriadoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += FeriadoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -478,16 +292,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -497,11 +302,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCiclolectivo !== null) { if (!$this->aCiclolectivo->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCiclolectivo->getValidationFailures()); @@ -521,28 +322,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = FeriadoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -567,19 +354,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = FeriadoPeer::getFieldNames($keyType); @@ -594,30 +371,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = FeriadoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -639,25 +400,9 @@ case 5: $this->setFkCiclolectivoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = FeriadoPeer::getFieldNames($keyType); @@ -670,11 +415,7 @@ if (array_key_exists($keys[5], $arr)) $this->setFkCiclolectivoId($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(FeriadoPeer::DATABASE_NAME); @@ -689,14 +430,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(FeriadoPeer::DATABASE_NAME); @@ -706,36 +440,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Feriado (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -752,40 +469,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Feriado Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return FeriadoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -794,13 +490,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Ciclolectivo object. - * - * @param Ciclolectivo $v - * @return void - * @throws PropelException - */ + public function setCiclolectivo($v) { @@ -816,33 +506,18 @@ } - /** - * Get the associated Ciclolectivo object - * - * @param Connection Optional Connection object. - * @return Ciclolectivo The associated Ciclolectivo object. - * @throws PropelException - */ + public function getCiclolectivo($con = null) { - // include the related Peer class - include_once 'model/om/BaseCiclolectivoPeer.php'; + include_once 'lib/model/om/BaseCiclolectivoPeer.php'; if ($this->aCiclolectivo === null && ($this->fk_ciclolectivo_id !== null)) { $this->aCiclolectivo = CiclolectivoPeer::retrieveByPK($this->fk_ciclolectivo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CiclolectivoPeer::retrieveByPK($this->fk_ciclolectivo_id, $con); - $obj->addCiclolectivos($this); - */ + } return $this->aCiclolectivo; } -} // BaseFeriado +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseFeriadoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseFeriadoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseFeriadoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by FeriadoPeer::getOMClass() -include_once 'model/Feriado.php'; -/** - * Base static class for performing query and update operations on the 'feriado' table. - * - * - * - * @package model.om - */ abstract class BaseFeriadoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'feriado'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Feriado'; + + const CLASS_DEFAULT = 'lib.model.Feriado'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'feriado.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'feriado.NOMBRE'; - /** the column name for the FECHA field */ + const FECHA = 'feriado.FECHA'; - /** the column name for the REPETICION_ANUAL field */ + const REPETICION_ANUAL = 'feriado.REPETICION_ANUAL'; - /** the column name for the INAMOVIBLE field */ + const INAMOVIBLE = 'feriado.INAMOVIBLE'; - /** the column name for the FK_CICLOLECTIVO_ID field */ + const FK_CICLOLECTIVO_ID = 'feriado.FK_CICLOLECTIVO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Fecha', 'RepeticionAnual', 'Inamovible', 'FkCiclolectivoId', ), BasePeer::TYPE_COLNAME => array (FeriadoPeer::ID, FeriadoPeer::NOMBRE, FeriadoPeer::FECHA, FeriadoPeer::REPETICION_ANUAL, FeriadoPeer::INAMOVIBLE, FeriadoPeer::FK_CICLOLECTIVO_ID, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Fecha' => 2, 'RepeticionAnual' => 3, 'Inamovible' => 4, 'FkCiclolectivoId' => 5, ), BasePeer::TYPE_COLNAME => array (FeriadoPeer::ID => 0, FeriadoPeer::NOMBRE => 1, FeriadoPeer::FECHA => 2, FeriadoPeer::REPETICION_ANUAL => 3, FeriadoPeer::INAMOVIBLE => 4, FeriadoPeer::FK_CICLOLECTIVO_ID => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/FeriadoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.FeriadoMapBuilder'); + include_once 'lib/model/map/FeriadoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.FeriadoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. FeriadoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(FeriadoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(feriado.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT feriado.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(FeriadoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(FeriadoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Feriado - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return FeriadoPeer::populateObjects(FeriadoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ FeriadoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = FeriadoPeer::getOMClass(); + $cls = FeriadoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -317,29 +198,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Ciclolectivo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCiclolectivo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(FeriadoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(FeriadoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -350,25 +221,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Feriado objects pre-filled with their Ciclolectivo objects. - * - * @return array Array of Feriado objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCiclolectivo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -396,46 +259,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCiclolectivo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCiclolectivo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addFeriado($obj1); //CHECKME - break; + $temp_obj2->addFeriado($obj1); break; } } if ($newObject) { $obj2->initFeriados(); - $obj2->addFeriado($obj1); //CHECKME - } + $obj2->addFeriado($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(FeriadoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(FeriadoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -446,25 +296,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Feriado objects pre-filled with all related objects. - * - * @return array Array of Feriado objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -489,8 +331,7 @@ $obj1->hydrate($rs); - // Add objects for joined Ciclolectivo rows - + $omClass = CiclolectivoPeer::getOMClass(); @@ -501,11 +342,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCiclolectivo(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCiclolectivo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addFeriado($obj1); // CHECKME - break; + $temp_obj2->addFeriado($obj1); break; } } @@ -519,41 +358,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return FeriadoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Feriado or Criteria object. - * - * @param mixed $values Criteria or Feriado object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -561,21 +378,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Feriado object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(FeriadoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(FeriadoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -586,15 +397,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Feriado or Criteria object. - * - * @param mixed $values Criteria or Feriado object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -604,37 +407,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(FeriadoPeer::ID); $selectCriteria->add(FeriadoPeer::ID, $criteria->remove(FeriadoPeer::ID), $comparison); - } else { // $values is Feriado object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the feriado table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(FeriadoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -644,17 +435,7 @@ } } - /** - * Method perform a DELETE on the database, given a Feriado or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Feriado object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -662,25 +443,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Feriado) { + $criteria = clone $values; } elseif ($values instanceof Feriado) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(FeriadoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -691,18 +466,7 @@ } } - /** - * Validates all modified columns of given Feriado object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Feriado $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Feriado $obj, $cols = null) { $columns = array(); @@ -737,13 +501,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Feriado - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -760,14 +518,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -785,20 +536,14 @@ return $objs; } -} // BaseFeriadoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseFeriadoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/FeriadoMapBuilder.php'; - Propel::registerMapBuilder('model.map.FeriadoMapBuilder'); + require_once 'lib/model/map/FeriadoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.FeriadoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,164 +1,86 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/HorarioescolarPeer.php'; - -/** - * Base class that represents a row from the 'horarioescolar' table. - * - * - * - * @package model.om - */ abstract class BaseHorarioescolar extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var HorarioescolarPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the dia field. - * @var int - */ + protected $dia = 0; - /** - * The value for the hora_inicio field. - * @var int - */ + protected $hora_inicio; - /** - * The value for the hora_fin field. - * @var int - */ + protected $hora_fin; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the fk_turnos_id field. - * @var int - */ + protected $fk_turnos_id = 0; - /** - * The value for the fk_horarioescolartipo_id field. - * @var int - */ + protected $fk_horarioescolartipo_id = 0; - /** - * @var Horarioescolartipo - */ + protected $aHorarioescolartipo; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * @var Turnos - */ + protected $aTurnos; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [dia] column value. - * - * @return int - */ + public function getDia() { return $this->dia; } - /** - * Get the [optionally formatted] [hora_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraInicio($format = '%X') + + public function getHoraInicio($format = 'H:i:s') { if ($this->hora_inicio === null || $this->hora_inicio === '') { return null; } elseif (!is_int($this->hora_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); + $ts = strtotime($this->hora_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); } } else { $ts = $this->hora_inicio; @@ -172,24 +94,15 @@ } } - /** - * Get the [optionally formatted] [hora_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraFin($format = '%X') + + public function getHoraFin($format = 'H:i:s') { if ($this->hora_fin === null || $this->hora_fin === '') { return null; } elseif (!is_int($this->hora_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); + $ts = strtotime($this->hora_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); } } else { $ts = $this->hora_fin; @@ -203,67 +116,42 @@ } } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [fk_turnos_id] column value. - * - * @return int - */ + public function getFkTurnosId() { return $this->fk_turnos_id; } - /** - * Get the [fk_horarioescolartipo_id] column value. - * - * @return int - */ + public function getFkHorarioescolartipoId() { return $this->fk_horarioescolartipo_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -272,14 +160,8 @@ $this->modifiedColumns[] = HorarioescolarPeer::ID; } - } // setId() - - /** - * Set the value of [dia] column. - * - * @param int $v new value - * @return void - */ + } + public function setDia($v) { @@ -288,21 +170,14 @@ $this->modifiedColumns[] = HorarioescolarPeer::DIA; } - } // setDia() - - /** - * Set the value of [hora_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -312,21 +187,14 @@ $this->modifiedColumns[] = HorarioescolarPeer::HORA_INICIO; } - } // setHoraInicio() - - /** - * Set the value of [hora_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -336,14 +204,8 @@ $this->modifiedColumns[] = HorarioescolarPeer::HORA_FIN; } - } // setHoraFin() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -352,14 +214,8 @@ $this->modifiedColumns[] = HorarioescolarPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -368,14 +224,8 @@ $this->modifiedColumns[] = HorarioescolarPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -388,14 +238,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [fk_turnos_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTurnosId($v) { @@ -408,14 +252,8 @@ $this->aTurnos = null; } - } // setFkTurnosId() - - /** - * Set the value of [fk_horarioescolartipo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkHorarioescolartipoId($v) { @@ -428,21 +266,8 @@ $this->aHorarioescolartipo = null; } - } // setFkHorarioescolartipoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -469,23 +294,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 9; // 9 = HorarioescolarPeer::NUM_COLUMNS - HorarioescolarPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 9; } catch (Exception $e) { throw new PropelException("Error populating Horarioescolar object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -507,16 +322,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -538,29 +344,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aHorarioescolartipo !== null) { if ($this->aHorarioescolartipo->isModified()) { $affectedRows += $this->aHorarioescolartipo->save($con); @@ -583,57 +374,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = HorarioescolarPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += HorarioescolarPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -646,16 +411,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -665,11 +421,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aHorarioescolartipo !== null) { if (!$this->aHorarioescolartipo->validate($columns)) { $failureMap = array_merge($failureMap, $this->aHorarioescolartipo->getValidationFailures()); @@ -701,28 +453,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = HorarioescolarPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -756,19 +494,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = HorarioescolarPeer::getFieldNames($keyType); @@ -786,30 +514,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = HorarioescolarPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -840,25 +552,9 @@ case 8: $this->setFkHorarioescolartipoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = HorarioescolarPeer::getFieldNames($keyType); @@ -874,11 +570,7 @@ if (array_key_exists($keys[8], $arr)) $this->setFkHorarioescolartipoId($arr[$keys[8]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(HorarioescolarPeer::DATABASE_NAME); @@ -896,14 +588,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(HorarioescolarPeer::DATABASE_NAME); @@ -913,36 +598,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Horarioescolar (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -965,40 +633,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Horarioescolar Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return HorarioescolarPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1007,13 +654,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Horarioescolartipo object. - * - * @param Horarioescolartipo $v - * @return void - * @throws PropelException - */ + public function setHorarioescolartipo($v) { @@ -1029,42 +670,21 @@ } - /** - * Get the associated Horarioescolartipo object - * - * @param Connection Optional Connection object. - * @return Horarioescolartipo The associated Horarioescolartipo object. - * @throws PropelException - */ + public function getHorarioescolartipo($con = null) { - // include the related Peer class - include_once 'model/om/BaseHorarioescolartipoPeer.php'; + include_once 'lib/model/om/BaseHorarioescolartipoPeer.php'; if ($this->aHorarioescolartipo === null && ($this->fk_horarioescolartipo_id !== null)) { $this->aHorarioescolartipo = HorarioescolartipoPeer::retrieveByPK($this->fk_horarioescolartipo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = HorarioescolartipoPeer::retrieveByPK($this->fk_horarioescolartipo_id, $con); - $obj->addHorarioescolartipos($this); - */ + } return $this->aHorarioescolartipo; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -1080,42 +700,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Declares an association between this object and a Turnos object. - * - * @param Turnos $v - * @return void - * @throws PropelException - */ + public function setTurnos($v) { @@ -1131,33 +730,18 @@ } - /** - * Get the associated Turnos object - * - * @param Connection Optional Connection object. - * @return Turnos The associated Turnos object. - * @throws PropelException - */ + public function getTurnos($con = null) { - // include the related Peer class - include_once 'model/om/BaseTurnosPeer.php'; + include_once 'lib/model/om/BaseTurnosPeer.php'; if ($this->aTurnos === null && ($this->fk_turnos_id !== null)) { $this->aTurnos = TurnosPeer::retrieveByPK($this->fk_turnos_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TurnosPeer::retrieveByPK($this->fk_turnos_id, $con); - $obj->addTurnoss($this); - */ + } return $this->aTurnos; } -} // BaseHorarioescolar +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolarPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolarPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolarPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,72 +1,56 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by HorarioescolarPeer::getOMClass() -include_once 'model/Horarioescolar.php'; -/** - * Base static class for performing query and update operations on the 'horarioescolar' table. - * - * - * - * @package model.om - */ abstract class BaseHorarioescolarPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'horarioescolar'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Horarioescolar'; + + const CLASS_DEFAULT = 'lib.model.Horarioescolar'; - /** The total number of columns. */ + const NUM_COLUMNS = 9; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'horarioescolar.ID'; - /** the column name for the DIA field */ + const DIA = 'horarioescolar.DIA'; - /** the column name for the HORA_INICIO field */ + const HORA_INICIO = 'horarioescolar.HORA_INICIO'; - /** the column name for the HORA_FIN field */ + const HORA_FIN = 'horarioescolar.HORA_FIN'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'horarioescolar.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'horarioescolar.DESCRIPCION'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'horarioescolar.FK_ESTABLECIMIENTO_ID'; - /** the column name for the FK_TURNOS_ID field */ + const FK_TURNOS_ID = 'horarioescolar.FK_TURNOS_ID'; - /** the column name for the FK_HORARIOESCOLARTIPO_ID field */ + const FK_HORARIOESCOLARTIPO_ID = 'horarioescolar.FK_HORARIOESCOLARTIPO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Dia', 'HoraInicio', 'HoraFin', 'Nombre', 'Descripcion', 'FkEstablecimientoId', 'FkTurnosId', 'FkHorarioescolartipoId', ), BasePeer::TYPE_COLNAME => array (HorarioescolarPeer::ID, HorarioescolarPeer::DIA, HorarioescolarPeer::HORA_INICIO, HorarioescolarPeer::HORA_FIN, HorarioescolarPeer::NOMBRE, HorarioescolarPeer::DESCRIPCION, HorarioescolarPeer::FK_ESTABLECIMIENTO_ID, HorarioescolarPeer::FK_TURNOS_ID, HorarioescolarPeer::FK_HORARIOESCOLARTIPO_ID, ), @@ -74,12 +58,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Dia' => 1, 'HoraInicio' => 2, 'HoraFin' => 3, 'Nombre' => 4, 'Descripcion' => 5, 'FkEstablecimientoId' => 6, 'FkTurnosId' => 7, 'FkHorarioescolartipoId' => 8, ), BasePeer::TYPE_COLNAME => array (HorarioescolarPeer::ID => 0, HorarioescolarPeer::DIA => 1, HorarioescolarPeer::HORA_INICIO => 2, HorarioescolarPeer::HORA_FIN => 3, HorarioescolarPeer::NOMBRE => 4, HorarioescolarPeer::DESCRIPCION => 5, HorarioescolarPeer::FK_ESTABLECIMIENTO_ID => 6, HorarioescolarPeer::FK_TURNOS_ID => 7, HorarioescolarPeer::FK_HORARIOESCOLARTIPO_ID => 8, ), @@ -87,24 +66,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/HorarioescolarMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.HorarioescolarMapBuilder'); + include_once 'lib/model/map/HorarioescolarMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.HorarioescolarMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -118,15 +86,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -137,14 +97,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -154,34 +107,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. HorarioescolarPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(HorarioescolarPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -208,29 +140,19 @@ const COUNT = 'COUNT(horarioescolar.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT horarioescolar.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -239,19 +161,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Horarioescolar - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -262,33 +175,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return HorarioescolarPeer::populateObjects(HorarioescolarPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -300,29 +192,18 @@ HorarioescolarPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = HorarioescolarPeer::getOMClass(); + $cls = HorarioescolarPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -332,29 +213,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Horarioescolartipo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinHorarioescolartipo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -365,35 +236,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -404,35 +264,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Turnos table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTurnos(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -443,25 +292,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Horarioescolar objects pre-filled with their Horarioescolartipo objects. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinHorarioescolartipo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -489,37 +330,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getHorarioescolartipo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getHorarioescolartipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addHorarioescolar($obj1); //CHECKME - break; + $temp_obj2->addHorarioescolar($obj1); break; } } if ($newObject) { $obj2->initHorarioescolars(); - $obj2->addHorarioescolar($obj1); //CHECKME - } + $obj2->addHorarioescolar($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Horarioescolar objects pre-filled with their Establecimiento objects. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -547,37 +377,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addHorarioescolar($obj1); //CHECKME - break; + $temp_obj2->addHorarioescolar($obj1); break; } } if ($newObject) { $obj2->initHorarioescolars(); - $obj2->addHorarioescolar($obj1); //CHECKME - } + $obj2->addHorarioescolar($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Horarioescolar objects pre-filled with their Turnos objects. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTurnos(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -605,46 +424,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTurnos(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTurnos(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addHorarioescolar($obj1); //CHECKME - break; + $temp_obj2->addHorarioescolar($obj1); break; } } if ($newObject) { $obj2->initHorarioescolars(); - $obj2->addHorarioescolar($obj1); //CHECKME - } + $obj2->addHorarioescolar($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -659,25 +465,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Horarioescolar objects pre-filled with all related objects. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -712,8 +510,7 @@ $obj1->hydrate($rs); - // Add objects for joined Horarioescolartipo rows - + $omClass = HorarioescolartipoPeer::getOMClass(); @@ -724,11 +521,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getHorarioescolartipo(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getHorarioescolartipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addHorarioescolar($obj1); // CHECKME - break; + $temp_obj2->addHorarioescolar($obj1); break; } } @@ -738,8 +533,7 @@ } - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -750,11 +544,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getEstablecimiento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addHorarioescolar($obj1); // CHECKME - break; + $temp_obj3->addHorarioescolar($obj1); break; } } @@ -764,8 +556,7 @@ } - // Add objects for joined Turnos rows - + $omClass = TurnosPeer::getOMClass(); @@ -776,11 +567,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getTurnos(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getTurnos(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addHorarioescolar($obj1); // CHECKME - break; + $temp_obj4->addHorarioescolar($obj1); break; } } @@ -795,29 +584,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Horarioescolartipo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptHorarioescolartipo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -830,35 +609,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -871,35 +639,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Turnos table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTurnos(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolarPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolarPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -912,27 +669,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Horarioescolar objects pre-filled with all related objects except Horarioescolartipo. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptHorarioescolartipo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -971,8 +718,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addHorarioescolar($obj1); break; @@ -994,8 +740,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTurnos(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTurnos(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addHorarioescolar($obj1); break; @@ -1013,21 +758,12 @@ } - /** - * Selects a collection of Horarioescolar objects pre-filled with all related objects except Establecimiento. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1066,8 +802,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getHorarioescolartipo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getHorarioescolartipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addHorarioescolar($obj1); break; @@ -1089,8 +824,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTurnos(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTurnos(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addHorarioescolar($obj1); break; @@ -1108,21 +842,12 @@ } - /** - * Selects a collection of Horarioescolar objects pre-filled with all related objects except Turnos. - * - * @return array Array of Horarioescolar objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTurnos(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1161,8 +886,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getHorarioescolartipo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getHorarioescolartipo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addHorarioescolar($obj1); break; @@ -1184,8 +908,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getEstablecimiento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addHorarioescolar($obj1); break; @@ -1202,41 +925,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return HorarioescolarPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Horarioescolar or Criteria object. - * - * @param mixed $values Criteria or Horarioescolar object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1244,21 +945,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Horarioescolar object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(HorarioescolarPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(HorarioescolarPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1269,15 +964,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Horarioescolar or Criteria object. - * - * @param mixed $values Criteria or Horarioescolar object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1287,37 +974,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(HorarioescolarPeer::ID); $selectCriteria->add(HorarioescolarPeer::ID, $criteria->remove(HorarioescolarPeer::ID), $comparison); - } else { // $values is Horarioescolar object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the horarioescolar table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(HorarioescolarPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1327,17 +1002,7 @@ } } - /** - * Method perform a DELETE on the database, given a Horarioescolar or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Horarioescolar object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1345,25 +1010,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Horarioescolar) { + $criteria = clone $values; } elseif ($values instanceof Horarioescolar) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(HorarioescolarPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1374,18 +1033,7 @@ } } - /** - * Validates all modified columns of given Horarioescolar object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Horarioescolar $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Horarioescolar $obj, $cols = null) { $columns = array(); @@ -1420,13 +1068,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Horarioescolar - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1443,14 +1085,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1468,20 +1103,14 @@ return $objs; } -} // BaseHorarioescolarPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseHorarioescolarPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/HorarioescolarMapBuilder.php'; - Propel::registerMapBuilder('model.map.HorarioescolarMapBuilder'); + require_once 'lib/model/map/HorarioescolarMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.HorarioescolarMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/HorarioescolartipoPeer.php'; - -/** - * Base class that represents a row from the 'horarioescolartipo' table. - * - * - * - * @package model.om - */ abstract class BaseHorarioescolartipo extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var HorarioescolartipoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * Collection to store aggregation of collHorarioescolars. - * @var array - */ + protected $collHorarioescolars; - /** - * The criteria used to select the current contents of collHorarioescolars. - * @var Criteria - */ + protected $lastHorarioescolarCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = HorarioescolartipoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = HorarioescolartipoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = HorarioescolartipoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = HorarioescolartipoPeer::NUM_COLUMNS - HorarioescolartipoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Horarioescolartipo object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = HorarioescolartipoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += HorarioescolartipoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collHorarioescolars !== null) { foreach($this->collHorarioescolars as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = HorarioescolartipoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = HorarioescolartipoPeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = HorarioescolartipoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = HorarioescolartipoPeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(HorarioescolartipoPeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(HorarioescolartipoPeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Horarioescolartipo (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getHorarioescolars() as $relObj) { $copyObj->addHorarioescolar($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Horarioescolartipo Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return HorarioescolartipoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collHorarioescolars to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initHorarioescolars() { if ($this->collHorarioescolars === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Horarioescolartipo has previously - * been saved, it will retrieve related Horarioescolars from storage. - * If this Horarioescolartipo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getHorarioescolars($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(HorarioescolarPeer::FK_HORARIOESCOLARTIPO_ID, $this->getId()); HorarioescolarPeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collHorarioescolars; } - /** - * Returns the number of related Horarioescolars. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countHorarioescolars($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return HorarioescolarPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Horarioescolar object to this object - * through the Horarioescolar foreign key attribute - * - * @param Horarioescolar $l Horarioescolar - * @return void - * @throws PropelException - */ + public function addHorarioescolar(Horarioescolar $l) { $this->collHorarioescolars[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Horarioescolartipo is new, it will return - * an empty collection; or if this Horarioescolartipo has previously - * been saved, it will retrieve related Horarioescolars from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Horarioescolartipo. - */ + public function getHorarioescolarsJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(HorarioescolarPeer::FK_HORARIOESCOLARTIPO_ID, $this->getId()); if (!isset($this->lastHorarioescolarCriteria) || !$this->lastHorarioescolarCriteria->equals($criteria)) { @@ -788,21 +479,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Horarioescolartipo is new, it will return - * an empty collection; or if this Horarioescolartipo has previously - * been saved, it will retrieve related Horarioescolars from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Horarioescolartipo. - */ + public function getHorarioescolarsJoinTurnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -821,10 +501,7 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelectJoinTurnos($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(HorarioescolarPeer::FK_HORARIOESCOLARTIPO_ID, $this->getId()); if (!isset($this->lastHorarioescolarCriteria) || !$this->lastHorarioescolarCriteria->equals($criteria)) { @@ -836,4 +513,4 @@ return $this->collHorarioescolars; } -} // BaseHorarioescolartipo +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolartipoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by HorarioescolartipoPeer::getOMClass() -include_once 'model/Horarioescolartipo.php'; -/** - * Base static class for performing query and update operations on the 'horarioescolartipo' table. - * - * - * - * @package model.om - */ abstract class BaseHorarioescolartipoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'horarioescolartipo'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Horarioescolartipo'; + + const CLASS_DEFAULT = 'lib.model.Horarioescolartipo'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'horarioescolartipo.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'horarioescolartipo.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'horarioescolartipo.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (HorarioescolartipoPeer::ID, HorarioescolartipoPeer::NOMBRE, HorarioescolartipoPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (HorarioescolartipoPeer::ID => 0, HorarioescolartipoPeer::NOMBRE => 1, HorarioescolartipoPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/HorarioescolartipoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.HorarioescolartipoMapBuilder'); + include_once 'lib/model/map/HorarioescolartipoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.HorarioescolartipoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. HorarioescolartipoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(HorarioescolartipoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(horarioescolartipo.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT horarioescolartipo.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(HorarioescolartipoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(HorarioescolartipoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Horarioescolartipo - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return HorarioescolartipoPeer::populateObjects(HorarioescolartipoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ HorarioescolartipoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = HorarioescolartipoPeer::getOMClass(); + $cls = HorarioescolartipoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return HorarioescolartipoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Horarioescolartipo or Criteria object. - * - * @param mixed $values Criteria or Horarioescolartipo object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Horarioescolartipo object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(HorarioescolartipoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(HorarioescolartipoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Horarioescolartipo or Criteria object. - * - * @param mixed $values Criteria or Horarioescolartipo object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(HorarioescolartipoPeer::ID); $selectCriteria->add(HorarioescolartipoPeer::ID, $criteria->remove(HorarioescolartipoPeer::ID), $comparison); - } else { // $values is Horarioescolartipo object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the horarioescolartipo table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(HorarioescolartipoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Horarioescolartipo or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Horarioescolartipo object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Horarioescolartipo) { + $criteria = clone $values; } elseif ($values instanceof Horarioescolartipo) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(HorarioescolartipoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Horarioescolartipo object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Horarioescolartipo $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Horarioescolartipo $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Horarioescolartipo - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseHorarioescolartipoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseHorarioescolartipoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/HorarioescolartipoMapBuilder.php'; - Propel::registerMapBuilder('model.map.HorarioescolartipoMapBuilder'); + require_once 'lib/model/map/HorarioescolartipoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.HorarioescolartipoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjunto.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjunto.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjunto.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,98 +1,47 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/LegajoadjuntoPeer.php'; - -/** - * Base class that represents a row from the 'legajoadjunto' table. - * - * - * - * @package model.om - */ abstract class BaseLegajoadjunto extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var LegajoadjuntoPeer - */ + protected static $peer; - /** - * The value for the fk_legajopedagogico_id field. - * @var int - */ + protected $fk_legajopedagogico_id; - /** - * The value for the fk_adjunto_id field. - * @var int - */ + protected $fk_adjunto_id; - /** - * @var Adjunto - */ + protected $aAdjunto; - /** - * @var Legajopedagogico - */ + protected $aLegajopedagogico; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [fk_legajopedagogico_id] column value. - * - * @return int - */ + public function getFkLegajopedagogicoId() { return $this->fk_legajopedagogico_id; } - /** - * Get the [fk_adjunto_id] column value. - * - * @return int - */ + public function getFkAdjuntoId() { return $this->fk_adjunto_id; } - /** - * Set the value of [fk_legajopedagogico_id] column. - * - * @param int $v new value - * @return void - */ + public function setFkLegajopedagogicoId($v) { @@ -105,14 +54,8 @@ $this->aLegajopedagogico = null; } - } // setFkLegajopedagogicoId() - - /** - * Set the value of [fk_adjunto_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAdjuntoId($v) { @@ -125,21 +68,8 @@ $this->aAdjunto = null; } - } // setFkAdjuntoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -152,23 +82,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 2; // 2 = LegajoadjuntoPeer::NUM_COLUMNS - LegajoadjuntoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 2; } catch (Exception $e) { throw new PropelException("Error populating Legajoadjunto object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -190,16 +110,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -221,29 +132,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAdjunto !== null) { if ($this->aAdjunto->isModified()) { $affectedRows += $this->aAdjunto->save($con); @@ -259,55 +155,30 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = LegajoadjuntoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - + $affectedRows += 1; $this->setNew(false); } else { $affectedRows += LegajoadjuntoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -320,16 +191,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -339,11 +201,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAdjunto !== null) { if (!$this->aAdjunto->validate($columns)) { $failureMap = array_merge($failureMap, $this->aAdjunto->getValidationFailures()); @@ -369,28 +227,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = LegajoadjuntoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -403,19 +247,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = LegajoadjuntoPeer::getFieldNames($keyType); @@ -426,30 +260,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = LegajoadjuntoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -459,25 +277,9 @@ case 1: $this->setFkAdjuntoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = LegajoadjuntoPeer::getFieldNames($keyType); @@ -486,11 +288,7 @@ if (array_key_exists($keys[1], $arr)) $this->setFkAdjuntoId($arr[$keys[1]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(LegajoadjuntoPeer::DATABASE_NAME); @@ -501,14 +299,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(LegajoadjuntoPeer::DATABASE_NAME); @@ -517,40 +308,18 @@ return $criteria; } - /** - * Returns NULL since this table doesn't have a primary key. - * This method exists only for BC and is deprecated! - * @return null - */ + public function getPrimaryKey() { return null; } - /** - * Dummy primary key setter. - * - * This function only exists to preserve backwards compatibility. It is no longer - * needed or required by the Persistent interface. It will be removed in next BC-breaking - * release of Propel. - * - * @deprecated - */ + public function setPrimaryKey($pk) { - // do nothing, because this object doesn't have any primary keys - } + } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Legajoadjunto (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -563,36 +332,16 @@ } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Legajoadjunto Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return LegajoadjuntoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -601,13 +350,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Adjunto object. - * - * @param Adjunto $v - * @return void - * @throws PropelException - */ + public function setAdjunto($v) { @@ -623,42 +366,21 @@ } - /** - * Get the associated Adjunto object - * - * @param Connection Optional Connection object. - * @return Adjunto The associated Adjunto object. - * @throws PropelException - */ + public function getAdjunto($con = null) { - // include the related Peer class - include_once 'model/om/BaseAdjuntoPeer.php'; + include_once 'lib/model/om/BaseAdjuntoPeer.php'; if ($this->aAdjunto === null && ($this->fk_adjunto_id !== null)) { $this->aAdjunto = AdjuntoPeer::retrieveByPK($this->fk_adjunto_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AdjuntoPeer::retrieveByPK($this->fk_adjunto_id, $con); - $obj->addAdjuntos($this); - */ + } return $this->aAdjunto; } - /** - * Declares an association between this object and a Legajopedagogico object. - * - * @param Legajopedagogico $v - * @return void - * @throws PropelException - */ + public function setLegajopedagogico($v) { @@ -674,33 +396,18 @@ } - /** - * Get the associated Legajopedagogico object - * - * @param Connection Optional Connection object. - * @return Legajopedagogico The associated Legajopedagogico object. - * @throws PropelException - */ + public function getLegajopedagogico($con = null) { - // include the related Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($this->aLegajopedagogico === null && ($this->fk_legajopedagogico_id !== null)) { $this->aLegajopedagogico = LegajopedagogicoPeer::retrieveByPK($this->fk_legajopedagogico_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = LegajopedagogicoPeer::retrieveByPK($this->fk_legajopedagogico_id, $con); - $obj->addLegajopedagogicos($this); - */ + } return $this->aLegajopedagogico; } -} // BaseLegajoadjunto +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjuntoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjuntoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLegajoadjuntoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,51 +1,35 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by LegajoadjuntoPeer::getOMClass() -include_once 'model/Legajoadjunto.php'; -/** - * Base static class for performing query and update operations on the 'legajoadjunto' table. - * - * - * - * @package model.om - */ abstract class BaseLegajoadjuntoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'legajoadjunto'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Legajoadjunto'; + + const CLASS_DEFAULT = 'lib.model.Legajoadjunto'; - /** The total number of columns. */ + const NUM_COLUMNS = 2; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the FK_LEGAJOPEDAGOGICO_ID field */ + const FK_LEGAJOPEDAGOGICO_ID = 'legajoadjunto.FK_LEGAJOPEDAGOGICO_ID'; - /** the column name for the FK_ADJUNTO_ID field */ + const FK_ADJUNTO_ID = 'legajoadjunto.FK_ADJUNTO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('FkLegajopedagogicoId', 'FkAdjuntoId', ), BasePeer::TYPE_COLNAME => array (LegajoadjuntoPeer::FK_LEGAJOPEDAGOGICO_ID, LegajoadjuntoPeer::FK_ADJUNTO_ID, ), @@ -53,12 +37,7 @@ BasePeer::TYPE_NUM => array (0, 1, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('FkLegajopedagogicoId' => 0, 'FkAdjuntoId' => 1, ), BasePeer::TYPE_COLNAME => array (LegajoadjuntoPeer::FK_LEGAJOPEDAGOGICO_ID => 0, LegajoadjuntoPeer::FK_ADJUNTO_ID => 1, ), @@ -66,24 +45,13 @@ BasePeer::TYPE_NUM => array (0, 1, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/LegajoadjuntoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.LegajoadjuntoMapBuilder'); + include_once 'lib/model/map/LegajoadjuntoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.LegajoadjuntoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -97,15 +65,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -116,14 +76,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -133,34 +86,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. LegajoadjuntoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(LegajoadjuntoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -173,29 +105,19 @@ const COUNT = 'COUNT(*)'; const COUNT_DISTINCT = 'COUNT(DISTINCT *)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -204,19 +126,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Legajoadjunto - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -227,33 +140,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return LegajoadjuntoPeer::populateObjects(LegajoadjuntoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -265,29 +157,18 @@ LegajoadjuntoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = LegajoadjuntoPeer::getOMClass(); + $cls = LegajoadjuntoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -297,29 +178,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Adjunto table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAdjunto(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -330,35 +201,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Legajopedagogico table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinLegajopedagogico(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -369,25 +229,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Legajoadjunto objects pre-filled with their Adjunto objects. - * - * @return array Array of Legajoadjunto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAdjunto(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -415,37 +267,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAdjunto(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAdjunto(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLegajoadjunto($obj1); //CHECKME - break; + $temp_obj2->addLegajoadjunto($obj1); break; } } if ($newObject) { $obj2->initLegajoadjuntos(); - $obj2->addLegajoadjunto($obj1); //CHECKME - } + $obj2->addLegajoadjunto($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Legajoadjunto objects pre-filled with their Legajopedagogico objects. - * - * @return array Array of Legajoadjunto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinLegajopedagogico(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -473,46 +314,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getLegajopedagogico(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLegajopedagogico(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLegajoadjunto($obj1); //CHECKME - break; + $temp_obj2->addLegajoadjunto($obj1); break; } } if ($newObject) { $obj2->initLegajoadjuntos(); - $obj2->addLegajoadjunto($obj1); //CHECKME - } + $obj2->addLegajoadjunto($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -525,25 +353,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Legajoadjunto objects pre-filled with all related objects. - * - * @return array Array of Legajoadjunto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -573,8 +393,7 @@ $obj1->hydrate($rs); - // Add objects for joined Adjunto rows - + $omClass = AdjuntoPeer::getOMClass(); @@ -585,11 +404,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAdjunto(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAdjunto(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addLegajoadjunto($obj1); // CHECKME - break; + $temp_obj2->addLegajoadjunto($obj1); break; } } @@ -599,8 +416,7 @@ } - // Add objects for joined Legajopedagogico rows - + $omClass = LegajopedagogicoPeer::getOMClass(); @@ -611,11 +427,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getLegajopedagogico(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getLegajopedagogico(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addLegajoadjunto($obj1); // CHECKME - break; + $temp_obj3->addLegajoadjunto($obj1); break; } } @@ -630,29 +444,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Adjunto table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAdjunto(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -663,35 +467,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Legajopedagogico table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptLegajopedagogico(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajoadjuntoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -702,27 +495,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Legajoadjunto objects pre-filled with all related objects except Adjunto. - * - * @return array Array of Legajoadjunto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAdjunto(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -756,8 +539,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getLegajopedagogico(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLegajopedagogico(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLegajoadjunto($obj1); break; @@ -775,21 +557,12 @@ } - /** - * Selects a collection of Legajoadjunto objects pre-filled with all related objects except Legajopedagogico. - * - * @return array Array of Legajoadjunto objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptLegajopedagogico(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -823,8 +596,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAdjunto(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAdjunto(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLegajoadjunto($obj1); break; @@ -841,41 +613,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return LegajoadjuntoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Legajoadjunto or Criteria object. - * - * @param mixed $values Criteria or Legajoadjunto object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -883,19 +633,14 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Legajoadjunto object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -906,15 +651,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Legajoadjunto or Criteria object. - * - * @param mixed $values Criteria or Legajoadjunto object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -924,34 +661,22 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity + $criteria = clone $values; + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - } else { // $values is Legajoadjunto object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + $criteria->setDbName(self::DATABASE_NAME); - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the legajoadjunto table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(LegajoadjuntoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -961,17 +686,7 @@ } } - /** - * Method perform a DELETE on the database, given a Legajoadjunto or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Legajoadjunto object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -979,20 +694,14 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Legajoadjunto) { + $criteria = clone $values; } elseif ($values instanceof Legajoadjunto) { $criteria = $values->buildCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); - // primary key is composite; we therefore, expect - // the primary key passed to be an array of pkey - // values - if(count($values) == count($values, COUNT_RECURSIVE)) + $criteria = new Criteria(self::DATABASE_NAME); + if(count($values) == count($values, COUNT_RECURSIVE)) { - // array is not multi-dimensional - $values = array($values); + $values = array($values); } $vals = array(); foreach($values as $value) @@ -1002,15 +711,11 @@ } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1021,18 +726,7 @@ } } - /** - * Validates all modified columns of given Legajoadjunto object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Legajoadjunto $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Legajoadjunto $obj, $cols = null) { $columns = array(); @@ -1067,20 +761,14 @@ return $res; } -} // BaseLegajoadjuntoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseLegajoadjuntoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/LegajoadjuntoMapBuilder.php'; - Propel::registerMapBuilder('model.map.LegajoadjuntoMapBuilder'); + require_once 'lib/model/map/LegajoadjuntoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.LegajoadjuntoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoria.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoria.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoria.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,100 +1,47 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/LegajocategoriaPeer.php'; - -/** - * Base class that represents a row from the 'legajocategoria' table. - * - * - * - * @package model.om - */ abstract class BaseLegajocategoria extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var LegajocategoriaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * Collection to store aggregation of collLegajopedagogicos. - * @var array - */ + protected $collLegajopedagogicos; - /** - * The criteria used to select the current contents of collLegajopedagogicos. - * @var Criteria - */ + protected $lastLegajopedagogicoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -103,14 +50,8 @@ $this->modifiedColumns[] = LegajocategoriaPeer::ID; } - } // setId() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -119,21 +60,8 @@ $this->modifiedColumns[] = LegajocategoriaPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -146,23 +74,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 2; // 2 = LegajocategoriaPeer::NUM_COLUMNS - LegajocategoriaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 2; } catch (Exception $e) { throw new PropelException("Error populating Legajocategoria object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -184,16 +102,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -215,40 +124,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = LegajocategoriaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += LegajocategoriaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collLegajopedagogicos !== null) { foreach($this->collLegajopedagogicos as $referrerFK) { @@ -261,37 +153,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -304,16 +176,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -343,28 +206,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = LegajocategoriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -377,19 +226,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = LegajocategoriaPeer::getFieldNames($keyType); @@ -400,30 +239,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = LegajocategoriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -433,25 +256,9 @@ case 1: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = LegajocategoriaPeer::getFieldNames($keyType); @@ -460,11 +267,7 @@ if (array_key_exists($keys[1], $arr)) $this->setDescripcion($arr[$keys[1]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(LegajocategoriaPeer::DATABASE_NAME); @@ -475,14 +278,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(LegajocategoriaPeer::DATABASE_NAME); @@ -492,36 +288,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Legajocategoria (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -529,53 +308,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getLegajopedagogicos() as $relObj) { $copyObj->addLegajopedagogico($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Legajocategoria Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return LegajocategoriaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -584,12 +339,7 @@ return self::$peer; } - /** - * Temporary storage of collLegajopedagogicos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLegajopedagogicos() { if ($this->collLegajopedagogicos === null) { @@ -597,23 +347,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Legajocategoria has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * If this Legajocategoria is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLegajopedagogicos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -633,13 +370,9 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LegajopedagogicoPeer::FK_LEGAJOCATEGORIA_ID, $this->getId()); LegajopedagogicoPeer::addSelectColumns($criteria); @@ -652,18 +385,10 @@ return $this->collLegajopedagogicos; } - /** - * Returns the number of related Legajopedagogicos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLegajopedagogicos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -677,14 +402,7 @@ return LegajopedagogicoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Legajopedagogico object to this object - * through the Legajopedagogico foreign key attribute - * - * @param Legajopedagogico $l Legajopedagogico - * @return void - * @throws PropelException - */ + public function addLegajopedagogico(Legajopedagogico $l) { $this->collLegajopedagogicos[] = $l; @@ -692,21 +410,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Legajocategoria is new, it will return - * an empty collection; or if this Legajocategoria has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Legajocategoria. - */ + public function getLegajopedagogicosJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -725,10 +432,7 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajopedagogicoPeer::FK_LEGAJOCATEGORIA_ID, $this->getId()); if (!isset($this->lastLegajopedagogicoCriteria) || !$this->lastLegajopedagogicoCriteria->equals($criteria)) { @@ -741,21 +445,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Legajocategoria is new, it will return - * an empty collection; or if this Legajocategoria has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Legajocategoria. - */ + public function getLegajopedagogicosJoinUsuario($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -774,10 +467,7 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelectJoinUsuario($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajopedagogicoPeer::FK_LEGAJOCATEGORIA_ID, $this->getId()); if (!isset($this->lastLegajopedagogicoCriteria) || !$this->lastLegajopedagogicoCriteria->equals($criteria)) { @@ -789,4 +479,4 @@ return $this->collLegajopedagogicos; } -} // BaseLegajocategoria +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoriaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoriaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLegajocategoriaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,51 +1,35 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by LegajocategoriaPeer::getOMClass() -include_once 'model/Legajocategoria.php'; -/** - * Base static class for performing query and update operations on the 'legajocategoria' table. - * - * - * - * @package model.om - */ abstract class BaseLegajocategoriaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'legajocategoria'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Legajocategoria'; + + const CLASS_DEFAULT = 'lib.model.Legajocategoria'; - /** The total number of columns. */ + const NUM_COLUMNS = 2; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'legajocategoria.ID'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'legajocategoria.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (LegajocategoriaPeer::ID, LegajocategoriaPeer::DESCRIPCION, ), @@ -53,12 +37,7 @@ BasePeer::TYPE_NUM => array (0, 1, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Descripcion' => 1, ), BasePeer::TYPE_COLNAME => array (LegajocategoriaPeer::ID => 0, LegajocategoriaPeer::DESCRIPCION => 1, ), @@ -66,24 +45,13 @@ BasePeer::TYPE_NUM => array (0, 1, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/LegajocategoriaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.LegajocategoriaMapBuilder'); + include_once 'lib/model/map/LegajocategoriaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.LegajocategoriaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -97,15 +65,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -116,14 +76,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -133,34 +86,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. LegajocategoriaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(LegajocategoriaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -173,29 +105,19 @@ const COUNT = 'COUNT(legajocategoria.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT legajocategoria.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajocategoriaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajocategoriaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -204,19 +126,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Legajocategoria - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -227,33 +140,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return LegajocategoriaPeer::populateObjects(LegajocategoriaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -265,29 +157,18 @@ LegajocategoriaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = LegajocategoriaPeer::getOMClass(); + $cls = LegajocategoriaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -296,41 +177,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return LegajocategoriaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Legajocategoria or Criteria object. - * - * @param mixed $values Criteria or Legajocategoria object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -338,21 +197,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Legajocategoria object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(LegajocategoriaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(LegajocategoriaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -363,15 +216,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Legajocategoria or Criteria object. - * - * @param mixed $values Criteria or Legajocategoria object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -381,37 +226,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(LegajocategoriaPeer::ID); $selectCriteria->add(LegajocategoriaPeer::ID, $criteria->remove(LegajocategoriaPeer::ID), $comparison); - } else { // $values is Legajocategoria object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the legajocategoria table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(LegajocategoriaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -421,17 +254,7 @@ } } - /** - * Method perform a DELETE on the database, given a Legajocategoria or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Legajocategoria object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -439,25 +262,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Legajocategoria) { + $criteria = clone $values; } elseif ($values instanceof Legajocategoria) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(LegajocategoriaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -468,18 +285,7 @@ } } - /** - * Validates all modified columns of given Legajocategoria object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Legajocategoria $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Legajocategoria $obj, $cols = null) { $columns = array(); @@ -514,13 +320,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Legajocategoria - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -537,14 +337,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -562,20 +355,14 @@ return $objs; } -} // BaseLegajocategoriaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseLegajocategoriaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/LegajocategoriaMapBuilder.php'; - Propel::registerMapBuilder('model.map.LegajocategoriaMapBuilder'); + require_once 'lib/model/map/LegajocategoriaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.LegajocategoriaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogico.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogico.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogico.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,205 +1,109 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - -include_once 'creole/util/Clob.php'; -include_once 'creole/util/Blob.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/LegajopedagogicoPeer.php'; - -/** - * Base class that represents a row from the 'legajopedagogico' table. - * - * - * - * @package model.om - */ abstract class BaseLegajopedagogico extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var LegajopedagogicoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id; - /** - * The value for the titulo field. - * @var string - */ + protected $titulo; - /** - * The value for the resumen field. - * @var string - */ + protected $resumen; - /** - * The value for the texto field. - * @var string - */ + protected $texto; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * The value for the fk_usuario_id field. - * @var int - */ + protected $fk_usuario_id; - /** - * The value for the fk_legajocategoria_id field. - * @var int - */ + protected $fk_legajocategoria_id; - /** - * @var Legajocategoria - */ + protected $aLegajocategoria; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * @var Usuario - */ + protected $aUsuario; - /** - * Collection to store aggregation of collLegajoadjuntos. - * @var array - */ + protected $collLegajoadjuntos; - /** - * The criteria used to select the current contents of collLegajoadjuntos. - * @var Criteria - */ + protected $lastLegajoadjuntoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Get the [titulo] column value. - * - * @return string - */ + public function getTitulo() { return $this->titulo; } - /** - * Get the [resumen] column value. - * - * @return string - */ + public function getResumen() { return $this->resumen; } - /** - * Get the [texto] column value. - * - * @return string - */ + public function getTexto() { return $this->texto; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -213,34 +117,21 @@ } } - /** - * Get the [fk_usuario_id] column value. - * - * @return int - */ + public function getFkUsuarioId() { return $this->fk_usuario_id; } - /** - * Get the [fk_legajocategoria_id] column value. - * - * @return int - */ + public function getFkLegajocategoriaId() { return $this->fk_legajocategoria_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -249,14 +140,8 @@ $this->modifiedColumns[] = LegajopedagogicoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -269,14 +154,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Set the value of [titulo] column. - * - * @param string $v new value - * @return void - */ + } + public function setTitulo($v) { @@ -285,21 +164,12 @@ $this->modifiedColumns[] = LegajopedagogicoPeer::TITULO; } - } // setTitulo() - - /** - * Set the value of [resumen] column. - * - * @param string $v new value - * @return void - */ + } + public function setResumen($v) { - // if the passed in parameter is the *same* object that - // is stored internally then we use the Lob->isModified() - // method to know whether contents changed. - if ($v instanceof Lob && $v === $this->resumen) { + if ($v instanceof Lob && $v === $this->resumen) { $changed = $v->isModified(); } else { $changed = ($this->resumen !== $v); @@ -315,21 +185,12 @@ $this->modifiedColumns[] = LegajopedagogicoPeer::RESUMEN; } - } // setResumen() - - /** - * Set the value of [texto] column. - * - * @param string $v new value - * @return void - */ + } + public function setTexto($v) { - // if the passed in parameter is the *same* object that - // is stored internally then we use the Lob->isModified() - // method to know whether contents changed. - if ($v instanceof Lob && $v === $this->texto) { + if ($v instanceof Lob && $v === $this->texto) { $changed = $v->isModified(); } else { $changed = ($this->texto !== $v); @@ -345,21 +206,14 @@ $this->modifiedColumns[] = LegajopedagogicoPeer::TEXTO; } - } // setTexto() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -369,14 +223,8 @@ $this->modifiedColumns[] = LegajopedagogicoPeer::FECHA; } - } // setFecha() - - /** - * Set the value of [fk_usuario_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkUsuarioId($v) { @@ -389,14 +237,8 @@ $this->aUsuario = null; } - } // setFkUsuarioId() - - /** - * Set the value of [fk_legajocategoria_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkLegajocategoriaId($v) { @@ -409,21 +251,8 @@ $this->aLegajocategoria = null; } - } // setFkLegajocategoriaId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -448,23 +277,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 8; // 8 = LegajopedagogicoPeer::NUM_COLUMNS - LegajopedagogicoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 8; } catch (Exception $e) { throw new PropelException("Error populating Legajopedagogico object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -486,16 +305,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -517,29 +327,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aLegajocategoria !== null) { if ($this->aLegajocategoria->isModified()) { $affectedRows += $this->aLegajocategoria->save($con); @@ -562,22 +357,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = LegajopedagogicoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += LegajopedagogicoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collLegajoadjuntos !== null) { foreach($this->collLegajoadjuntos as $referrerFK) { @@ -590,37 +379,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -633,16 +402,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -652,11 +412,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aLegajocategoria !== null) { if (!$this->aLegajocategoria->validate($columns)) { $failureMap = array_merge($failureMap, $this->aLegajocategoria->getValidationFailures()); @@ -696,28 +452,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = LegajopedagogicoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -748,19 +490,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = LegajopedagogicoPeer::getFieldNames($keyType); @@ -777,30 +509,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = LegajopedagogicoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -828,25 +544,9 @@ case 7: $this->setFkLegajocategoriaId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = LegajopedagogicoPeer::getFieldNames($keyType); @@ -861,11 +561,7 @@ if (array_key_exists($keys[7], $arr)) $this->setFkLegajocategoriaId($arr[$keys[7]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(LegajopedagogicoPeer::DATABASE_NAME); @@ -882,14 +578,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(LegajopedagogicoPeer::DATABASE_NAME); @@ -899,36 +588,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Legajopedagogico (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -948,53 +620,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getLegajoadjuntos() as $relObj) { $copyObj->addLegajoadjunto($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Legajopedagogico Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return LegajopedagogicoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1003,13 +651,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Legajocategoria object. - * - * @param Legajocategoria $v - * @return void - * @throws PropelException - */ + public function setLegajocategoria($v) { @@ -1025,42 +667,21 @@ } - /** - * Get the associated Legajocategoria object - * - * @param Connection Optional Connection object. - * @return Legajocategoria The associated Legajocategoria object. - * @throws PropelException - */ + public function getLegajocategoria($con = null) { - // include the related Peer class - include_once 'model/om/BaseLegajocategoriaPeer.php'; + include_once 'lib/model/om/BaseLegajocategoriaPeer.php'; if ($this->aLegajocategoria === null && ($this->fk_legajocategoria_id !== null)) { $this->aLegajocategoria = LegajocategoriaPeer::retrieveByPK($this->fk_legajocategoria_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = LegajocategoriaPeer::retrieveByPK($this->fk_legajocategoria_id, $con); - $obj->addLegajocategorias($this); - */ + } return $this->aLegajocategoria; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -1076,42 +697,21 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } - /** - * Declares an association between this object and a Usuario object. - * - * @param Usuario $v - * @return void - * @throws PropelException - */ + public function setUsuario($v) { @@ -1127,41 +727,21 @@ } - /** - * Get the associated Usuario object - * - * @param Connection Optional Connection object. - * @return Usuario The associated Usuario object. - * @throws PropelException - */ + public function getUsuario($con = null) { - // include the related Peer class - include_once 'model/om/BaseUsuarioPeer.php'; + include_once 'lib/model/om/BaseUsuarioPeer.php'; if ($this->aUsuario === null && ($this->fk_usuario_id !== null)) { $this->aUsuario = UsuarioPeer::retrieveByPK($this->fk_usuario_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = UsuarioPeer::retrieveByPK($this->fk_usuario_id, $con); - $obj->addUsuarios($this); - */ + } return $this->aUsuario; } - /** - * Temporary storage of collLegajoadjuntos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLegajoadjuntos() { if ($this->collLegajoadjuntos === null) { @@ -1169,23 +749,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Legajopedagogico has previously - * been saved, it will retrieve related Legajoadjuntos from storage. - * If this Legajopedagogico is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLegajoadjuntos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajoadjuntoPeer.php'; + include_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1205,13 +772,9 @@ $this->collLegajoadjuntos = LegajoadjuntoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LegajoadjuntoPeer::FK_LEGAJOPEDAGOGICO_ID, $this->getId()); LegajoadjuntoPeer::addSelectColumns($criteria); @@ -1224,18 +787,10 @@ return $this->collLegajoadjuntos; } - /** - * Returns the number of related Legajoadjuntos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLegajoadjuntos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajoadjuntoPeer.php'; + include_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1249,14 +804,7 @@ return LegajoadjuntoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Legajoadjunto object to this object - * through the Legajoadjunto foreign key attribute - * - * @param Legajoadjunto $l Legajoadjunto - * @return void - * @throws PropelException - */ + public function addLegajoadjunto(Legajoadjunto $l) { $this->collLegajoadjuntos[] = $l; @@ -1264,21 +812,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Legajopedagogico is new, it will return - * an empty collection; or if this Legajopedagogico has previously - * been saved, it will retrieve related Legajoadjuntos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Legajopedagogico. - */ + public function getLegajoadjuntosJoinAdjunto($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajoadjuntoPeer.php'; + include_once 'lib/model/om/BaseLegajoadjuntoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1297,10 +834,7 @@ $this->collLegajoadjuntos = LegajoadjuntoPeer::doSelectJoinAdjunto($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajoadjuntoPeer::FK_LEGAJOPEDAGOGICO_ID, $this->getId()); if (!isset($this->lastLegajoadjuntoCriteria) || !$this->lastLegajoadjuntoCriteria->equals($criteria)) { @@ -1312,4 +846,4 @@ return $this->collLegajoadjuntos; } -} // BaseLegajopedagogico +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogicoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogicoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLegajopedagogicoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,69 +1,53 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by LegajopedagogicoPeer::getOMClass() -include_once 'model/Legajopedagogico.php'; -/** - * Base static class for performing query and update operations on the 'legajopedagogico' table. - * - * - * - * @package model.om - */ abstract class BaseLegajopedagogicoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'legajopedagogico'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Legajopedagogico'; + + const CLASS_DEFAULT = 'lib.model.Legajopedagogico'; - /** The total number of columns. */ + const NUM_COLUMNS = 8; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'legajopedagogico.ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'legajopedagogico.FK_ALUMNO_ID'; - /** the column name for the TITULO field */ + const TITULO = 'legajopedagogico.TITULO'; - /** the column name for the RESUMEN field */ + const RESUMEN = 'legajopedagogico.RESUMEN'; - /** the column name for the TEXTO field */ + const TEXTO = 'legajopedagogico.TEXTO'; - /** the column name for the FECHA field */ + const FECHA = 'legajopedagogico.FECHA'; - /** the column name for the FK_USUARIO_ID field */ + const FK_USUARIO_ID = 'legajopedagogico.FK_USUARIO_ID'; - /** the column name for the FK_LEGAJOCATEGORIA_ID field */ + const FK_LEGAJOCATEGORIA_ID = 'legajopedagogico.FK_LEGAJOCATEGORIA_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkAlumnoId', 'Titulo', 'Resumen', 'Texto', 'Fecha', 'FkUsuarioId', 'FkLegajocategoriaId', ), BasePeer::TYPE_COLNAME => array (LegajopedagogicoPeer::ID, LegajopedagogicoPeer::FK_ALUMNO_ID, LegajopedagogicoPeer::TITULO, LegajopedagogicoPeer::RESUMEN, LegajopedagogicoPeer::TEXTO, LegajopedagogicoPeer::FECHA, LegajopedagogicoPeer::FK_USUARIO_ID, LegajopedagogicoPeer::FK_LEGAJOCATEGORIA_ID, ), @@ -71,12 +55,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkAlumnoId' => 1, 'Titulo' => 2, 'Resumen' => 3, 'Texto' => 4, 'Fecha' => 5, 'FkUsuarioId' => 6, 'FkLegajocategoriaId' => 7, ), BasePeer::TYPE_COLNAME => array (LegajopedagogicoPeer::ID => 0, LegajopedagogicoPeer::FK_ALUMNO_ID => 1, LegajopedagogicoPeer::TITULO => 2, LegajopedagogicoPeer::RESUMEN => 3, LegajopedagogicoPeer::TEXTO => 4, LegajopedagogicoPeer::FECHA => 5, LegajopedagogicoPeer::FK_USUARIO_ID => 6, LegajopedagogicoPeer::FK_LEGAJOCATEGORIA_ID => 7, ), @@ -84,24 +63,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/LegajopedagogicoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.LegajopedagogicoMapBuilder'); + include_once 'lib/model/map/LegajopedagogicoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.LegajopedagogicoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -115,15 +83,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -134,14 +94,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -151,34 +104,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. LegajopedagogicoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(LegajopedagogicoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -203,29 +135,19 @@ const COUNT = 'COUNT(legajopedagogico.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT legajopedagogico.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -234,19 +156,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Legajopedagogico - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -257,33 +170,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return LegajopedagogicoPeer::populateObjects(LegajopedagogicoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -295,29 +187,18 @@ LegajopedagogicoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = LegajopedagogicoPeer::getOMClass(); + $cls = LegajopedagogicoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -327,29 +208,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Legajocategoria table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinLegajocategoria(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -360,35 +231,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -399,35 +259,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Usuario table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinUsuario(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -438,25 +287,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Legajopedagogico objects pre-filled with their Legajocategoria objects. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinLegajocategoria(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -484,37 +325,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getLegajocategoria(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLegajocategoria(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLegajopedagogico($obj1); //CHECKME - break; + $temp_obj2->addLegajopedagogico($obj1); break; } } if ($newObject) { $obj2->initLegajopedagogicos(); - $obj2->addLegajopedagogico($obj1); //CHECKME - } + $obj2->addLegajopedagogico($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Legajopedagogico objects pre-filled with their Alumno objects. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -542,37 +372,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLegajopedagogico($obj1); //CHECKME - break; + $temp_obj2->addLegajopedagogico($obj1); break; } } if ($newObject) { $obj2->initLegajopedagogicos(); - $obj2->addLegajopedagogico($obj1); //CHECKME - } + $obj2->addLegajopedagogico($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Legajopedagogico objects pre-filled with their Usuario objects. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinUsuario(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -600,46 +419,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getUsuario(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getUsuario(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLegajopedagogico($obj1); //CHECKME - break; + $temp_obj2->addLegajopedagogico($obj1); break; } } if ($newObject) { $obj2->initLegajopedagogicos(); - $obj2->addLegajopedagogico($obj1); //CHECKME - } + $obj2->addLegajopedagogico($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -654,25 +460,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Legajopedagogico objects pre-filled with all related objects. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -707,8 +505,7 @@ $obj1->hydrate($rs); - // Add objects for joined Legajocategoria rows - + $omClass = LegajocategoriaPeer::getOMClass(); @@ -719,11 +516,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getLegajocategoria(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLegajocategoria(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addLegajopedagogico($obj1); // CHECKME - break; + $temp_obj2->addLegajopedagogico($obj1); break; } } @@ -733,8 +528,7 @@ } - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -745,11 +539,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addLegajopedagogico($obj1); // CHECKME - break; + $temp_obj3->addLegajopedagogico($obj1); break; } } @@ -759,8 +551,7 @@ } - // Add objects for joined Usuario rows - + $omClass = UsuarioPeer::getOMClass(); @@ -771,11 +562,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getUsuario(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getUsuario(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addLegajopedagogico($obj1); // CHECKME - break; + $temp_obj4->addLegajopedagogico($obj1); break; } } @@ -790,29 +579,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Legajocategoria table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptLegajocategoria(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -825,35 +604,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -866,35 +634,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Usuario table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptUsuario(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LegajopedagogicoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -907,27 +664,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Legajopedagogico objects pre-filled with all related objects except Legajocategoria. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptLegajocategoria(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -966,8 +713,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLegajopedagogico($obj1); break; @@ -989,8 +735,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getUsuario(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getUsuario(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addLegajopedagogico($obj1); break; @@ -1008,21 +753,12 @@ } - /** - * Selects a collection of Legajopedagogico objects pre-filled with all related objects except Alumno. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1061,8 +797,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getLegajocategoria(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLegajocategoria(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLegajopedagogico($obj1); break; @@ -1084,8 +819,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getUsuario(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getUsuario(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addLegajopedagogico($obj1); break; @@ -1103,21 +837,12 @@ } - /** - * Selects a collection of Legajopedagogico objects pre-filled with all related objects except Usuario. - * - * @return array Array of Legajopedagogico objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptUsuario(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1156,8 +881,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getLegajocategoria(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLegajocategoria(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLegajopedagogico($obj1); break; @@ -1179,8 +903,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addLegajopedagogico($obj1); break; @@ -1197,41 +920,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return LegajopedagogicoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Legajopedagogico or Criteria object. - * - * @param mixed $values Criteria or Legajopedagogico object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1239,21 +940,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Legajopedagogico object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(LegajopedagogicoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(LegajopedagogicoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1264,15 +959,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Legajopedagogico or Criteria object. - * - * @param mixed $values Criteria or Legajopedagogico object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1282,37 +969,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(LegajopedagogicoPeer::ID); $selectCriteria->add(LegajopedagogicoPeer::ID, $criteria->remove(LegajopedagogicoPeer::ID), $comparison); - } else { // $values is Legajopedagogico object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the legajopedagogico table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(LegajopedagogicoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1322,17 +997,7 @@ } } - /** - * Method perform a DELETE on the database, given a Legajopedagogico or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Legajopedagogico object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1340,25 +1005,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Legajopedagogico) { + $criteria = clone $values; } elseif ($values instanceof Legajopedagogico) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(LegajopedagogicoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1369,18 +1028,7 @@ } } - /** - * Validates all modified columns of given Legajopedagogico object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Legajopedagogico $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Legajopedagogico $obj, $cols = null) { $columns = array(); @@ -1415,13 +1063,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Legajopedagogico - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1438,14 +1080,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1463,20 +1098,14 @@ return $objs; } -} // BaseLegajopedagogicoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseLegajopedagogicoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/LegajopedagogicoMapBuilder.php'; - Propel::registerMapBuilder('model.map.LegajopedagogicoMapBuilder'); + require_once 'lib/model/map/LegajopedagogicoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.LegajopedagogicoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,320 +1,180 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/LocacionPeer.php'; - -/** - * Base class that represents a row from the 'locacion' table. - * - * - * - * @package model.om - */ abstract class BaseLocacion extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var LocacionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion = ''; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad = ''; - /** - * The value for the codigo_postal field. - * @var string - */ + protected $codigo_postal = ''; - /** - * The value for the fk_provincia_id field. - * @var int - */ + protected $fk_provincia_id = 0; - /** - * The value for the fk_tipolocacion_id field. - * @var int - */ + protected $fk_tipolocacion_id = 0; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono; - /** - * The value for the fax field. - * @var string - */ + protected $fax; - /** - * The value for the encargado field. - * @var string - */ + protected $encargado; - /** - * The value for the encargado_telefono field. - * @var string - */ + protected $encargado_telefono; - /** - * The value for the principal field. - * @var boolean - */ + protected $principal = true; - /** - * @var Provincia - */ + protected $aProvincia; - /** - * @var Tipolocacion - */ + protected $aTipolocacion; - /** - * Collection to store aggregation of collEspacios. - * @var array - */ + protected $collEspacios; - /** - * The criteria used to select the current contents of collEspacios. - * @var Criteria - */ + protected $lastEspacioCriteria = null; - /** - * Collection to store aggregation of collRelEstablecimientoLocacions. - * @var array - */ + protected $collRelEstablecimientoLocacions; - /** - * The criteria used to select the current contents of collRelEstablecimientoLocacions. - * @var Criteria - */ + protected $lastRelEstablecimientoLocacionCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Get the [codigo_postal] column value. - * - * @return string - */ + public function getCodigoPostal() { return $this->codigo_postal; } - /** - * Get the [fk_provincia_id] column value. - * - * @return int - */ + public function getFkProvinciaId() { return $this->fk_provincia_id; } - /** - * Get the [fk_tipolocacion_id] column value. - * - * @return int - */ + public function getFkTipolocacionId() { return $this->fk_tipolocacion_id; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [fax] column value. - * - * @return string - */ + public function getFax() { return $this->fax; } - /** - * Get the [encargado] column value. - * - * @return string - */ + public function getEncargado() { return $this->encargado; } - /** - * Get the [encargado_telefono] column value. - * - * @return string - */ + public function getEncargadoTelefono() { return $this->encargado_telefono; } - /** - * Get the [principal] column value. - * - * @return boolean - */ + public function getPrincipal() { return $this->principal; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -323,14 +183,8 @@ $this->modifiedColumns[] = LocacionPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -339,14 +193,8 @@ $this->modifiedColumns[] = LocacionPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -355,14 +203,8 @@ $this->modifiedColumns[] = LocacionPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -371,14 +213,8 @@ $this->modifiedColumns[] = LocacionPeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -387,14 +223,8 @@ $this->modifiedColumns[] = LocacionPeer::CIUDAD; } - } // setCiudad() - - /** - * Set the value of [codigo_postal] column. - * - * @param string $v new value - * @return void - */ + } + public function setCodigoPostal($v) { @@ -403,14 +233,8 @@ $this->modifiedColumns[] = LocacionPeer::CODIGO_POSTAL; } - } // setCodigoPostal() - - /** - * Set the value of [fk_provincia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkProvinciaId($v) { @@ -423,14 +247,8 @@ $this->aProvincia = null; } - } // setFkProvinciaId() - - /** - * Set the value of [fk_tipolocacion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipolocacionId($v) { @@ -443,14 +261,8 @@ $this->aTipolocacion = null; } - } // setFkTipolocacionId() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -459,14 +271,8 @@ $this->modifiedColumns[] = LocacionPeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [fax] column. - * - * @param string $v new value - * @return void - */ + } + public function setFax($v) { @@ -475,14 +281,8 @@ $this->modifiedColumns[] = LocacionPeer::FAX; } - } // setFax() - - /** - * Set the value of [encargado] column. - * - * @param string $v new value - * @return void - */ + } + public function setEncargado($v) { @@ -491,14 +291,8 @@ $this->modifiedColumns[] = LocacionPeer::ENCARGADO; } - } // setEncargado() - - /** - * Set the value of [encargado_telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setEncargadoTelefono($v) { @@ -507,14 +301,8 @@ $this->modifiedColumns[] = LocacionPeer::ENCARGADO_TELEFONO; } - } // setEncargadoTelefono() - - /** - * Set the value of [principal] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setPrincipal($v) { @@ -523,21 +311,8 @@ $this->modifiedColumns[] = LocacionPeer::PRINCIPAL; } - } // setPrincipal() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -572,23 +347,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 13; // 13 = LocacionPeer::NUM_COLUMNS - LocacionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 13; } catch (Exception $e) { throw new PropelException("Error populating Locacion object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -610,16 +375,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -641,29 +397,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aProvincia !== null) { if ($this->aProvincia->isModified()) { $affectedRows += $this->aProvincia->save($con); @@ -679,22 +420,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = LocacionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += LocacionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collEspacios !== null) { foreach($this->collEspacios as $referrerFK) { @@ -715,37 +450,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -758,16 +473,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -777,11 +483,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aProvincia !== null) { if (!$this->aProvincia->validate($columns)) { $failureMap = array_merge($failureMap, $this->aProvincia->getValidationFailures()); @@ -823,28 +525,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = LocacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -890,19 +578,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = LocacionPeer::getFieldNames($keyType); @@ -924,30 +602,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = LocacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -990,25 +652,9 @@ case 12: $this->setPrincipal($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = LocacionPeer::getFieldNames($keyType); @@ -1028,11 +674,7 @@ if (array_key_exists($keys[12], $arr)) $this->setPrincipal($arr[$keys[12]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(LocacionPeer::DATABASE_NAME); @@ -1054,14 +696,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(LocacionPeer::DATABASE_NAME); @@ -1071,36 +706,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Locacion (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1130,9 +748,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getEspacios() as $relObj) { $copyObj->addEspacio($relObj->copy($deepCopy)); @@ -1142,45 +758,23 @@ $copyObj->addRelEstablecimientoLocacion($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Locacion Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return LocacionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1189,13 +783,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Provincia object. - * - * @param Provincia $v - * @return void - * @throws PropelException - */ + public function setProvincia($v) { @@ -1211,42 +799,21 @@ } - /** - * Get the associated Provincia object - * - * @param Connection Optional Connection object. - * @return Provincia The associated Provincia object. - * @throws PropelException - */ + public function getProvincia($con = null) { - // include the related Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($this->aProvincia === null && ($this->fk_provincia_id !== null)) { $this->aProvincia = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - $obj->addProvincias($this); - */ + } return $this->aProvincia; } - /** - * Declares an association between this object and a Tipolocacion object. - * - * @param Tipolocacion $v - * @return void - * @throws PropelException - */ + public function setTipolocacion($v) { @@ -1262,41 +829,21 @@ } - /** - * Get the associated Tipolocacion object - * - * @param Connection Optional Connection object. - * @return Tipolocacion The associated Tipolocacion object. - * @throws PropelException - */ + public function getTipolocacion($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipolocacionPeer.php'; + include_once 'lib/model/om/BaseTipolocacionPeer.php'; if ($this->aTipolocacion === null && ($this->fk_tipolocacion_id !== null)) { $this->aTipolocacion = TipolocacionPeer::retrieveByPK($this->fk_tipolocacion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipolocacionPeer::retrieveByPK($this->fk_tipolocacion_id, $con); - $obj->addTipolocacions($this); - */ + } return $this->aTipolocacion; } - /** - * Temporary storage of collEspacios to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initEspacios() { if ($this->collEspacios === null) { @@ -1304,23 +851,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Locacion has previously - * been saved, it will retrieve related Espacios from storage. - * If this Locacion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getEspacios($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1340,13 +874,9 @@ $this->collEspacios = EspacioPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(EspacioPeer::FK_LOCACION_ID, $this->getId()); EspacioPeer::addSelectColumns($criteria); @@ -1359,18 +889,10 @@ return $this->collEspacios; } - /** - * Returns the number of related Espacios. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countEspacios($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1384,14 +906,7 @@ return EspacioPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Espacio object to this object - * through the Espacio foreign key attribute - * - * @param Espacio $l Espacio - * @return void - * @throws PropelException - */ + public function addEspacio(Espacio $l) { $this->collEspacios[] = $l; @@ -1399,21 +914,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Locacion is new, it will return - * an empty collection; or if this Locacion has previously - * been saved, it will retrieve related Espacios from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Locacion. - */ + public function getEspaciosJoinTipoespacio($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1432,10 +936,7 @@ $this->collEspacios = EspacioPeer::doSelectJoinTipoespacio($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EspacioPeer::FK_LOCACION_ID, $this->getId()); if (!isset($this->lastEspacioCriteria) || !$this->lastEspacioCriteria->equals($criteria)) { @@ -1447,12 +948,7 @@ return $this->collEspacios; } - /** - * Temporary storage of collRelEstablecimientoLocacions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelEstablecimientoLocacions() { if ($this->collRelEstablecimientoLocacions === null) { @@ -1460,23 +956,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Locacion has previously - * been saved, it will retrieve related RelEstablecimientoLocacions from storage. - * If this Locacion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelEstablecimientoLocacions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + include_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1496,13 +979,9 @@ $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, $this->getId()); RelEstablecimientoLocacionPeer::addSelectColumns($criteria); @@ -1515,18 +994,10 @@ return $this->collRelEstablecimientoLocacions; } - /** - * Returns the number of related RelEstablecimientoLocacions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelEstablecimientoLocacions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + include_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1540,14 +1011,7 @@ return RelEstablecimientoLocacionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelEstablecimientoLocacion object to this object - * through the RelEstablecimientoLocacion foreign key attribute - * - * @param RelEstablecimientoLocacion $l RelEstablecimientoLocacion - * @return void - * @throws PropelException - */ + public function addRelEstablecimientoLocacion(RelEstablecimientoLocacion $l) { $this->collRelEstablecimientoLocacions[] = $l; @@ -1555,21 +1019,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Locacion is new, it will return - * an empty collection; or if this Locacion has previously - * been saved, it will retrieve related RelEstablecimientoLocacions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Locacion. - */ + public function getRelEstablecimientoLocacionsJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelEstablecimientoLocacionPeer.php'; + include_once 'lib/model/om/BaseRelEstablecimientoLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1588,10 +1041,7 @@ $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, $this->getId()); if (!isset($this->lastRelEstablecimientoLocacionCriteria) || !$this->lastRelEstablecimientoLocacionCriteria->equals($criteria)) { @@ -1603,4 +1053,4 @@ return $this->collRelEstablecimientoLocacions; } -} // BaseLocacion +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseLocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseLocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseLocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,84 +1,68 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by LocacionPeer::getOMClass() -include_once 'model/Locacion.php'; -/** - * Base static class for performing query and update operations on the 'locacion' table. - * - * - * - * @package model.om - */ abstract class BaseLocacionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'locacion'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Locacion'; + + const CLASS_DEFAULT = 'lib.model.Locacion'; - /** The total number of columns. */ + const NUM_COLUMNS = 13; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'locacion.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'locacion.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'locacion.DESCRIPCION'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'locacion.DIRECCION'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'locacion.CIUDAD'; - /** the column name for the CODIGO_POSTAL field */ + const CODIGO_POSTAL = 'locacion.CODIGO_POSTAL'; - /** the column name for the FK_PROVINCIA_ID field */ + const FK_PROVINCIA_ID = 'locacion.FK_PROVINCIA_ID'; - /** the column name for the FK_TIPOLOCACION_ID field */ + const FK_TIPOLOCACION_ID = 'locacion.FK_TIPOLOCACION_ID'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'locacion.TELEFONO'; - /** the column name for the FAX field */ + const FAX = 'locacion.FAX'; - /** the column name for the ENCARGADO field */ + const ENCARGADO = 'locacion.ENCARGADO'; - /** the column name for the ENCARGADO_TELEFONO field */ + const ENCARGADO_TELEFONO = 'locacion.ENCARGADO_TELEFONO'; - /** the column name for the PRINCIPAL field */ + const PRINCIPAL = 'locacion.PRINCIPAL'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'Direccion', 'Ciudad', 'CodigoPostal', 'FkProvinciaId', 'FkTipolocacionId', 'Telefono', 'Fax', 'Encargado', 'EncargadoTelefono', 'Principal', ), BasePeer::TYPE_COLNAME => array (LocacionPeer::ID, LocacionPeer::NOMBRE, LocacionPeer::DESCRIPCION, LocacionPeer::DIRECCION, LocacionPeer::CIUDAD, LocacionPeer::CODIGO_POSTAL, LocacionPeer::FK_PROVINCIA_ID, LocacionPeer::FK_TIPOLOCACION_ID, LocacionPeer::TELEFONO, LocacionPeer::FAX, LocacionPeer::ENCARGADO, LocacionPeer::ENCARGADO_TELEFONO, LocacionPeer::PRINCIPAL, ), @@ -86,12 +70,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'Direccion' => 3, 'Ciudad' => 4, 'CodigoPostal' => 5, 'FkProvinciaId' => 6, 'FkTipolocacionId' => 7, 'Telefono' => 8, 'Fax' => 9, 'Encargado' => 10, 'EncargadoTelefono' => 11, 'Principal' => 12, ), BasePeer::TYPE_COLNAME => array (LocacionPeer::ID => 0, LocacionPeer::NOMBRE => 1, LocacionPeer::DESCRIPCION => 2, LocacionPeer::DIRECCION => 3, LocacionPeer::CIUDAD => 4, LocacionPeer::CODIGO_POSTAL => 5, LocacionPeer::FK_PROVINCIA_ID => 6, LocacionPeer::FK_TIPOLOCACION_ID => 7, LocacionPeer::TELEFONO => 8, LocacionPeer::FAX => 9, LocacionPeer::ENCARGADO => 10, LocacionPeer::ENCARGADO_TELEFONO => 11, LocacionPeer::PRINCIPAL => 12, ), @@ -99,24 +78,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/LocacionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.LocacionMapBuilder'); + include_once 'lib/model/map/LocacionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.LocacionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -130,15 +98,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -149,14 +109,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -166,34 +119,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. LocacionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(LocacionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -228,29 +160,19 @@ const COUNT = 'COUNT(locacion.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT locacion.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -259,19 +181,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Locacion - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -282,33 +195,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return LocacionPeer::populateObjects(LocacionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -320,29 +212,18 @@ LocacionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = LocacionPeer::getOMClass(); + $cls = LocacionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -352,29 +233,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -385,35 +256,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipolocacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipolocacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -424,25 +284,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Locacion objects pre-filled with their Provincia objects. - * - * @return array Array of Locacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -470,37 +322,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLocacion($obj1); //CHECKME - break; + $temp_obj2->addLocacion($obj1); break; } } if ($newObject) { $obj2->initLocacions(); - $obj2->addLocacion($obj1); //CHECKME - } + $obj2->addLocacion($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Locacion objects pre-filled with their Tipolocacion objects. - * - * @return array Array of Locacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipolocacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -528,46 +369,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipolocacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipolocacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addLocacion($obj1); //CHECKME - break; + $temp_obj2->addLocacion($obj1); break; } } if ($newObject) { $obj2->initLocacions(); - $obj2->addLocacion($obj1); //CHECKME - } + $obj2->addLocacion($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -580,25 +408,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Locacion objects pre-filled with all related objects. - * - * @return array Array of Locacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -628,8 +448,7 @@ $obj1->hydrate($rs); - // Add objects for joined Provincia rows - + $omClass = ProvinciaPeer::getOMClass(); @@ -640,11 +459,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getProvincia(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addLocacion($obj1); // CHECKME - break; + $temp_obj2->addLocacion($obj1); break; } } @@ -654,8 +471,7 @@ } - // Add objects for joined Tipolocacion rows - + $omClass = TipolocacionPeer::getOMClass(); @@ -666,11 +482,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipolocacion(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipolocacion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addLocacion($obj1); // CHECKME - break; + $temp_obj3->addLocacion($obj1); break; } } @@ -685,29 +499,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -718,35 +522,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipolocacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipolocacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(LocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(LocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -757,27 +550,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Locacion objects pre-filled with all related objects except Provincia. - * - * @return array Array of Locacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -811,8 +594,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipolocacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipolocacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLocacion($obj1); break; @@ -830,21 +612,12 @@ } - /** - * Selects a collection of Locacion objects pre-filled with all related objects except Tipolocacion. - * - * @return array Array of Locacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipolocacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -878,8 +651,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLocacion($obj1); break; @@ -896,41 +668,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return LocacionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Locacion or Criteria object. - * - * @param mixed $values Criteria or Locacion object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -938,21 +688,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Locacion object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(LocacionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(LocacionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -963,15 +707,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Locacion or Criteria object. - * - * @param mixed $values Criteria or Locacion object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -981,37 +717,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(LocacionPeer::ID); $selectCriteria->add(LocacionPeer::ID, $criteria->remove(LocacionPeer::ID), $comparison); - } else { // $values is Locacion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the locacion table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(LocacionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1021,17 +745,7 @@ } } - /** - * Method perform a DELETE on the database, given a Locacion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Locacion object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1039,25 +753,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Locacion) { + $criteria = clone $values; } elseif ($values instanceof Locacion) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(LocacionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1068,18 +776,7 @@ } } - /** - * Validates all modified columns of given Locacion object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Locacion $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Locacion $obj, $cols = null) { $columns = array(); @@ -1114,13 +811,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Locacion - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1137,14 +828,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1162,20 +846,14 @@ return $objs; } -} // BaseLocacionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseLocacionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/LocacionMapBuilder.php'; - Propel::registerMapBuilder('model.map.LocacionMapBuilder'); + require_once 'lib/model/map/LocacionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.LocacionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseMenu.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseMenu.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseMenu.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,195 +1,105 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/MenuPeer.php'; - -/** - * Base class that represents a row from the 'menu' table. - * - * - * - * @package model.om - */ abstract class BaseMenu extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var MenuPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the link field. - * @var string - */ + protected $link = ''; - /** - * The value for the perm field. - * @var string - */ + protected $perm = ''; - /** - * The value for the target field. - * @var string - */ + protected $target = ''; - /** - * The value for the fk_padre_menu_id field. - * @var int - */ + protected $fk_padre_menu_id; - /** - * The value for the orden field. - * @var int - */ + protected $orden; - /** - * @var Menu - */ + protected $aMenuRelatedByFkPadreMenuId; - /** - * Collection to store aggregation of collMenusRelatedByFkPadreMenuId. - * @var array - */ + protected $collMenusRelatedByFkPadreMenuId; - /** - * The criteria used to select the current contents of collMenusRelatedByFkPadreMenuId. - * @var Criteria - */ + protected $lastMenuRelatedByFkPadreMenuIdCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [link] column value. - * - * @return string - */ + public function getLink() { return $this->link; } - /** - * Get the [perm] column value. - * - * @return string - */ + public function getPerm() { return $this->perm; } - /** - * Get the [target] column value. - * - * @return string - */ + public function getTarget() { return $this->target; } - /** - * Get the [fk_padre_menu_id] column value. - * - * @return int - */ + public function getFkPadreMenuId() { return $this->fk_padre_menu_id; } - /** - * Get the [orden] column value. - * - * @return int - */ + public function getOrden() { return $this->orden; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -198,14 +108,8 @@ $this->modifiedColumns[] = MenuPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -214,14 +118,8 @@ $this->modifiedColumns[] = MenuPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [link] column. - * - * @param string $v new value - * @return void - */ + } + public function setLink($v) { @@ -230,14 +128,8 @@ $this->modifiedColumns[] = MenuPeer::LINK; } - } // setLink() - - /** - * Set the value of [perm] column. - * - * @param string $v new value - * @return void - */ + } + public function setPerm($v) { @@ -246,14 +138,8 @@ $this->modifiedColumns[] = MenuPeer::PERM; } - } // setPerm() - - /** - * Set the value of [target] column. - * - * @param string $v new value - * @return void - */ + } + public function setTarget($v) { @@ -262,14 +148,8 @@ $this->modifiedColumns[] = MenuPeer::TARGET; } - } // setTarget() - - /** - * Set the value of [fk_padre_menu_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPadreMenuId($v) { @@ -282,14 +162,8 @@ $this->aMenuRelatedByFkPadreMenuId = null; } - } // setFkPadreMenuId() - - /** - * Set the value of [orden] column. - * - * @param int $v new value - * @return void - */ + } + public function setOrden($v) { @@ -298,21 +172,8 @@ $this->modifiedColumns[] = MenuPeer::ORDEN; } - } // setOrden() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -335,23 +196,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 7; // 7 = MenuPeer::NUM_COLUMNS - MenuPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 7; } catch (Exception $e) { throw new PropelException("Error populating Menu object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -373,16 +224,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -404,29 +246,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aMenuRelatedByFkPadreMenuId !== null) { if ($this->aMenuRelatedByFkPadreMenuId->isModified()) { $affectedRows += $this->aMenuRelatedByFkPadreMenuId->save($con); @@ -435,22 +262,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = MenuPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += MenuPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collMenusRelatedByFkPadreMenuId !== null) { foreach($this->collMenusRelatedByFkPadreMenuId as $referrerFK) { @@ -463,37 +284,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -506,16 +307,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -525,11 +317,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aMenuRelatedByFkPadreMenuId !== null) { if (!$this->aMenuRelatedByFkPadreMenuId->validate($columns)) { $failureMap = array_merge($failureMap, $this->aMenuRelatedByFkPadreMenuId->getValidationFailures()); @@ -549,28 +337,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = MenuPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -598,19 +372,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = MenuPeer::getFieldNames($keyType); @@ -626,30 +390,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = MenuPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -674,25 +422,9 @@ case 6: $this->setOrden($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = MenuPeer::getFieldNames($keyType); @@ -706,11 +438,7 @@ if (array_key_exists($keys[6], $arr)) $this->setOrden($arr[$keys[6]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(MenuPeer::DATABASE_NAME); @@ -726,14 +454,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(MenuPeer::DATABASE_NAME); @@ -743,36 +464,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Menu (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -790,9 +494,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getMenusRelatedByFkPadreMenuId() as $relObj) { if($this->getPrimaryKey() === $relObj->getPrimaryKey()) { @@ -802,45 +504,23 @@ $copyObj->addMenuRelatedByFkPadreMenuId($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Menu Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return MenuPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -849,13 +529,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Menu object. - * - * @param Menu $v - * @return void - * @throws PropelException - */ + public function setMenuRelatedByFkPadreMenuId($v) { @@ -871,41 +545,21 @@ } - /** - * Get the associated Menu object - * - * @param Connection Optional Connection object. - * @return Menu The associated Menu object. - * @throws PropelException - */ + public function getMenuRelatedByFkPadreMenuId($con = null) { - // include the related Peer class - include_once 'model/om/BaseMenuPeer.php'; + include_once 'lib/model/om/BaseMenuPeer.php'; if ($this->aMenuRelatedByFkPadreMenuId === null && ($this->fk_padre_menu_id !== null)) { $this->aMenuRelatedByFkPadreMenuId = MenuPeer::retrieveByPK($this->fk_padre_menu_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = MenuPeer::retrieveByPK($this->fk_padre_menu_id, $con); - $obj->addMenusRelatedByFkPadreMenuId($this); - */ + } return $this->aMenuRelatedByFkPadreMenuId; } - /** - * Temporary storage of collMenusRelatedByFkPadreMenuId to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initMenusRelatedByFkPadreMenuId() { if ($this->collMenusRelatedByFkPadreMenuId === null) { @@ -913,23 +567,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Menu has previously - * been saved, it will retrieve related MenusRelatedByFkPadreMenuId from storage. - * If this Menu is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getMenusRelatedByFkPadreMenuId($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseMenuPeer.php'; + include_once 'lib/model/om/BaseMenuPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -949,13 +590,9 @@ $this->collMenusRelatedByFkPadreMenuId = MenuPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(MenuPeer::FK_PADRE_MENU_ID, $this->getId()); MenuPeer::addSelectColumns($criteria); @@ -968,18 +605,10 @@ return $this->collMenusRelatedByFkPadreMenuId; } - /** - * Returns the number of related MenusRelatedByFkPadreMenuId. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countMenusRelatedByFkPadreMenuId($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseMenuPeer.php'; + include_once 'lib/model/om/BaseMenuPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -993,18 +622,11 @@ return MenuPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Menu object to this object - * through the Menu foreign key attribute - * - * @param Menu $l Menu - * @return void - * @throws PropelException - */ + public function addMenuRelatedByFkPadreMenuId(Menu $l) { $this->collMenusRelatedByFkPadreMenuId[] = $l; $l->setMenuRelatedByFkPadreMenuId($this); } -} // BaseMenu +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseMenuPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseMenuPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseMenuPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,66 +1,50 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by MenuPeer::getOMClass() -include_once 'model/Menu.php'; -/** - * Base static class for performing query and update operations on the 'menu' table. - * - * - * - * @package model.om - */ abstract class BaseMenuPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'menu'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Menu'; + + const CLASS_DEFAULT = 'lib.model.Menu'; - /** The total number of columns. */ + const NUM_COLUMNS = 7; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'menu.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'menu.NOMBRE'; - /** the column name for the LINK field */ + const LINK = 'menu.LINK'; - /** the column name for the PERM field */ + const PERM = 'menu.PERM'; - /** the column name for the TARGET field */ + const TARGET = 'menu.TARGET'; - /** the column name for the FK_PADRE_MENU_ID field */ + const FK_PADRE_MENU_ID = 'menu.FK_PADRE_MENU_ID'; - /** the column name for the ORDEN field */ + const ORDEN = 'menu.ORDEN'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Link', 'Perm', 'Target', 'FkPadreMenuId', 'Orden', ), BasePeer::TYPE_COLNAME => array (MenuPeer::ID, MenuPeer::NOMBRE, MenuPeer::LINK, MenuPeer::PERM, MenuPeer::TARGET, MenuPeer::FK_PADRE_MENU_ID, MenuPeer::ORDEN, ), @@ -68,12 +52,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Link' => 2, 'Perm' => 3, 'Target' => 4, 'FkPadreMenuId' => 5, 'Orden' => 6, ), BasePeer::TYPE_COLNAME => array (MenuPeer::ID => 0, MenuPeer::NOMBRE => 1, MenuPeer::LINK => 2, MenuPeer::PERM => 3, MenuPeer::TARGET => 4, MenuPeer::FK_PADRE_MENU_ID => 5, MenuPeer::ORDEN => 6, ), @@ -81,24 +60,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/MenuMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.MenuMapBuilder'); + include_once 'lib/model/map/MenuMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.MenuMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -112,15 +80,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -131,14 +91,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -148,34 +101,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. MenuPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(MenuPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -198,29 +130,19 @@ const COUNT = 'COUNT(menu.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT menu.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(MenuPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(MenuPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -229,19 +151,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Menu - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -252,33 +165,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return MenuPeer::populateObjects(MenuPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -290,29 +182,18 @@ MenuPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = MenuPeer::getOMClass(); + $cls = MenuPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -322,28 +203,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(MenuPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(MenuPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -352,25 +224,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Menu objects pre-filled with all related objects. - * - * @return array Array of Menu objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -394,41 +258,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return MenuPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Menu or Criteria object. - * - * @param mixed $values Criteria or Menu object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -436,21 +278,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Menu object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(MenuPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(MenuPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -461,15 +297,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Menu or Criteria object. - * - * @param mixed $values Criteria or Menu object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -479,37 +307,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(MenuPeer::ID); $selectCriteria->add(MenuPeer::ID, $criteria->remove(MenuPeer::ID), $comparison); - } else { // $values is Menu object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the menu table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(MenuPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -519,17 +335,7 @@ } } - /** - * Method perform a DELETE on the database, given a Menu or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Menu object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -537,25 +343,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Menu) { + $criteria = clone $values; } elseif ($values instanceof Menu) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(MenuPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -566,18 +366,7 @@ } } - /** - * Validates all modified columns of given Menu object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Menu $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Menu $obj, $cols = null) { $columns = array(); @@ -612,13 +401,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Menu - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -635,14 +418,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -660,20 +436,14 @@ return $objs; } -} // BaseMenuPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseMenuPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/MenuMapBuilder.php'; - Propel::registerMapBuilder('model.map.MenuMapBuilder'); + require_once 'lib/model/map/MenuMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.MenuMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseModulo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseModulo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseModulo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,154 +1,80 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ModuloPeer.php'; - -/** - * Base class that represents a row from the 'modulo' table. - * - * - * - * @package model.om - */ abstract class BaseModulo extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ModuloPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the titulo field. - * @var string - */ + protected $titulo; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the activo field. - * @var boolean - */ + protected $activo = true; - /** - * Collection to store aggregation of collPermisos. - * @var array - */ + protected $collPermisos; - /** - * The criteria used to select the current contents of collPermisos. - * @var Criteria - */ + protected $lastPermisoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [titulo] column value. - * - * @return string - */ + public function getTitulo() { return $this->titulo; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [activo] column value. - * - * @return boolean - */ + public function getActivo() { return $this->activo; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -157,14 +83,8 @@ $this->modifiedColumns[] = ModuloPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -173,14 +93,8 @@ $this->modifiedColumns[] = ModuloPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [titulo] column. - * - * @param string $v new value - * @return void - */ + } + public function setTitulo($v) { @@ -189,14 +103,8 @@ $this->modifiedColumns[] = ModuloPeer::TITULO; } - } // setTitulo() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -205,14 +113,8 @@ $this->modifiedColumns[] = ModuloPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [activo] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActivo($v) { @@ -221,21 +123,8 @@ $this->modifiedColumns[] = ModuloPeer::ACTIVO; } - } // setActivo() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -254,23 +143,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = ModuloPeer::NUM_COLUMNS - ModuloPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Modulo object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -292,16 +171,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -323,40 +193,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ModuloPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ModuloPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collPermisos !== null) { foreach($this->collPermisos as $referrerFK) { @@ -369,37 +222,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -412,16 +245,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -451,28 +275,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ModuloPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -494,19 +304,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ModuloPeer::getFieldNames($keyType); @@ -520,30 +320,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ModuloPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -562,25 +346,9 @@ case 4: $this->setActivo($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ModuloPeer::getFieldNames($keyType); @@ -592,11 +360,7 @@ if (array_key_exists($keys[4], $arr)) $this->setActivo($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ModuloPeer::DATABASE_NAME); @@ -610,14 +374,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ModuloPeer::DATABASE_NAME); @@ -627,36 +384,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Modulo (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -670,53 +410,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getPermisos() as $relObj) { $copyObj->addPermiso($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Modulo Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ModuloPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -725,12 +441,7 @@ return self::$peer; } - /** - * Temporary storage of collPermisos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initPermisos() { if ($this->collPermisos === null) { @@ -738,23 +449,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Modulo has previously - * been saved, it will retrieve related Permisos from storage. - * If this Modulo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getPermisos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BasePermisoPeer.php'; + include_once 'lib/model/om/BasePermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -774,13 +472,9 @@ $this->collPermisos = PermisoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(PermisoPeer::FK_MODULO_ID, $this->getId()); PermisoPeer::addSelectColumns($criteria); @@ -793,18 +487,10 @@ return $this->collPermisos; } - /** - * Returns the number of related Permisos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countPermisos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BasePermisoPeer.php'; + include_once 'lib/model/om/BasePermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -818,18 +504,11 @@ return PermisoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Permiso object to this object - * through the Permiso foreign key attribute - * - * @param Permiso $l Permiso - * @return void - * @throws PropelException - */ + public function addPermiso(Permiso $l) { $this->collPermisos[] = $l; $l->setModulo($this); } -} // BaseModulo +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseModuloPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseModuloPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseModuloPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ModuloPeer::getOMClass() -include_once 'model/Modulo.php'; -/** - * Base static class for performing query and update operations on the 'modulo' table. - * - * - * - * @package model.om - */ abstract class BaseModuloPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'modulo'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Modulo'; + + const CLASS_DEFAULT = 'lib.model.Modulo'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'modulo.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'modulo.NOMBRE'; - /** the column name for the TITULO field */ + const TITULO = 'modulo.TITULO'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'modulo.DESCRIPCION'; - /** the column name for the ACTIVO field */ + const ACTIVO = 'modulo.ACTIVO'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Titulo', 'Descripcion', 'Activo', ), BasePeer::TYPE_COLNAME => array (ModuloPeer::ID, ModuloPeer::NOMBRE, ModuloPeer::TITULO, ModuloPeer::DESCRIPCION, ModuloPeer::ACTIVO, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Titulo' => 2, 'Descripcion' => 3, 'Activo' => 4, ), BasePeer::TYPE_COLNAME => array (ModuloPeer::ID => 0, ModuloPeer::NOMBRE => 1, ModuloPeer::TITULO => 2, ModuloPeer::DESCRIPCION => 3, ModuloPeer::ACTIVO => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ModuloMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ModuloMapBuilder'); + include_once 'lib/model/map/ModuloMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ModuloMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ModuloPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ModuloPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(modulo.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT modulo.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ModuloPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ModuloPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Modulo - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ModuloPeer::populateObjects(ModuloPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ ModuloPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ModuloPeer::getOMClass(); + $cls = ModuloPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -311,41 +192,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ModuloPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Modulo or Criteria object. - * - * @param mixed $values Criteria or Modulo object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -353,21 +212,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Modulo object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ModuloPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ModuloPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -378,15 +231,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Modulo or Criteria object. - * - * @param mixed $values Criteria or Modulo object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -396,37 +241,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ModuloPeer::ID); $selectCriteria->add(ModuloPeer::ID, $criteria->remove(ModuloPeer::ID), $comparison); - } else { // $values is Modulo object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the modulo table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ModuloPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -436,17 +269,7 @@ } } - /** - * Method perform a DELETE on the database, given a Modulo or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Modulo object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -454,25 +277,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Modulo) { + $criteria = clone $values; } elseif ($values instanceof Modulo) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ModuloPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -483,18 +300,7 @@ } } - /** - * Validates all modified columns of given Modulo object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Modulo $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Modulo $obj, $cols = null) { $columns = array(); @@ -529,13 +335,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Modulo - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -552,14 +352,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -577,20 +370,14 @@ return $objs; } -} // BaseModuloPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseModuloPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ModuloMapBuilder.php'; - Propel::registerMapBuilder('model.map.ModuloMapBuilder'); + require_once 'lib/model/map/ModuloMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ModuloMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/NiveltipoPeer.php'; - -/** - * Base class that represents a row from the 'niveltipo' table. - * - * - * - * @package model.om - */ abstract class BaseNiveltipo extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var NiveltipoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * Collection to store aggregation of collEstablecimientos. - * @var array - */ + protected $collEstablecimientos; - /** - * The criteria used to select the current contents of collEstablecimientos. - * @var Criteria - */ + protected $lastEstablecimientoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = NiveltipoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = NiveltipoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = NiveltipoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = NiveltipoPeer::NUM_COLUMNS - NiveltipoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Niveltipo object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = NiveltipoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += NiveltipoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collEstablecimientos !== null) { foreach($this->collEstablecimientos as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = NiveltipoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = NiveltipoPeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = NiveltipoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = NiveltipoPeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(NiveltipoPeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(NiveltipoPeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Niveltipo (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getEstablecimientos() as $relObj) { $copyObj->addEstablecimiento($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Niveltipo Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return NiveltipoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collEstablecimientos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initEstablecimientos() { if ($this->collEstablecimientos === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Niveltipo has previously - * been saved, it will retrieve related Establecimientos from storage. - * If this Niveltipo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getEstablecimientos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(EstablecimientoPeer::FK_NIVELTIPO_ID, $this->getId()); EstablecimientoPeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collEstablecimientos; } - /** - * Returns the number of related Establecimientos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countEstablecimientos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return EstablecimientoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Establecimiento object to this object - * through the Establecimiento foreign key attribute - * - * @param Establecimiento $l Establecimiento - * @return void - * @throws PropelException - */ + public function addEstablecimiento(Establecimiento $l) { $this->collEstablecimientos[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Niveltipo is new, it will return - * an empty collection; or if this Niveltipo has previously - * been saved, it will retrieve related Establecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Niveltipo. - */ + public function getEstablecimientosJoinOrganizacion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinOrganizacion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EstablecimientoPeer::FK_NIVELTIPO_ID, $this->getId()); if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) { @@ -788,21 +479,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Niveltipo is new, it will return - * an empty collection; or if this Niveltipo has previously - * been saved, it will retrieve related Establecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Niveltipo. - */ + public function getEstablecimientosJoinDistritoescolar($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -821,10 +501,7 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinDistritoescolar($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EstablecimientoPeer::FK_NIVELTIPO_ID, $this->getId()); if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) { @@ -836,4 +513,4 @@ return $this->collEstablecimientos; } -} // BaseNiveltipo +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseNiveltipoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by NiveltipoPeer::getOMClass() -include_once 'model/Niveltipo.php'; -/** - * Base static class for performing query and update operations on the 'niveltipo' table. - * - * - * - * @package model.om - */ abstract class BaseNiveltipoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'niveltipo'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Niveltipo'; + + const CLASS_DEFAULT = 'lib.model.Niveltipo'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'niveltipo.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'niveltipo.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'niveltipo.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (NiveltipoPeer::ID, NiveltipoPeer::NOMBRE, NiveltipoPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (NiveltipoPeer::ID => 0, NiveltipoPeer::NOMBRE => 1, NiveltipoPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/NiveltipoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.NiveltipoMapBuilder'); + include_once 'lib/model/map/NiveltipoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.NiveltipoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. NiveltipoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(NiveltipoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(niveltipo.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT niveltipo.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(NiveltipoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(NiveltipoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Niveltipo - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return NiveltipoPeer::populateObjects(NiveltipoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ NiveltipoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = NiveltipoPeer::getOMClass(); + $cls = NiveltipoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return NiveltipoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Niveltipo or Criteria object. - * - * @param mixed $values Criteria or Niveltipo object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Niveltipo object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(NiveltipoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(NiveltipoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Niveltipo or Criteria object. - * - * @param mixed $values Criteria or Niveltipo object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(NiveltipoPeer::ID); $selectCriteria->add(NiveltipoPeer::ID, $criteria->remove(NiveltipoPeer::ID), $comparison); - } else { // $values is Niveltipo object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the niveltipo table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(NiveltipoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Niveltipo or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Niveltipo object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Niveltipo) { + $criteria = clone $values; } elseif ($values instanceof Niveltipo) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(NiveltipoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Niveltipo object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Niveltipo $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Niveltipo $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Niveltipo - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseNiveltipoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseNiveltipoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/NiveltipoMapBuilder.php'; - Propel::registerMapBuilder('model.map.NiveltipoMapBuilder'); + require_once 'lib/model/map/NiveltipoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.NiveltipoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,272 +1,152 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/OrganizacionPeer.php'; - -/** - * Base class that represents a row from the 'organizacion' table. - * - * - * - * @package model.om - */ abstract class BaseOrganizacion extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var OrganizacionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the razon_social field. - * @var string - */ + protected $razon_social = ''; - /** - * The value for the cuit field. - * @var string - */ + protected $cuit = ''; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion = ''; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad = ''; - /** - * The value for the codigo_postal field. - * @var string - */ + protected $codigo_postal = ''; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono = ''; - /** - * The value for the fk_provincia_id field. - * @var int - */ + protected $fk_provincia_id = 0; - /** - * The value for the fk_tipoiva_id field. - * @var int - */ + protected $fk_tipoiva_id = 0; - /** - * @var Tipoiva - */ + protected $aTipoiva; - /** - * @var Provincia - */ + protected $aProvincia; - /** - * Collection to store aggregation of collEstablecimientos. - * @var array - */ + protected $collEstablecimientos; - /** - * The criteria used to select the current contents of collEstablecimientos. - * @var Criteria - */ + protected $lastEstablecimientoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [razon_social] column value. - * - * @return string - */ + public function getRazonSocial() { return $this->razon_social; } - /** - * Get the [cuit] column value. - * - * @return string - */ + public function getCuit() { return $this->cuit; } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Get the [codigo_postal] column value. - * - * @return string - */ + public function getCodigoPostal() { return $this->codigo_postal; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [fk_provincia_id] column value. - * - * @return int - */ + public function getFkProvinciaId() { return $this->fk_provincia_id; } - /** - * Get the [fk_tipoiva_id] column value. - * - * @return int - */ + public function getFkTipoivaId() { return $this->fk_tipoiva_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -275,14 +155,8 @@ $this->modifiedColumns[] = OrganizacionPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -291,14 +165,8 @@ $this->modifiedColumns[] = OrganizacionPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -307,14 +175,8 @@ $this->modifiedColumns[] = OrganizacionPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [razon_social] column. - * - * @param string $v new value - * @return void - */ + } + public function setRazonSocial($v) { @@ -323,14 +185,8 @@ $this->modifiedColumns[] = OrganizacionPeer::RAZON_SOCIAL; } - } // setRazonSocial() - - /** - * Set the value of [cuit] column. - * - * @param string $v new value - * @return void - */ + } + public function setCuit($v) { @@ -339,14 +195,8 @@ $this->modifiedColumns[] = OrganizacionPeer::CUIT; } - } // setCuit() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -355,14 +205,8 @@ $this->modifiedColumns[] = OrganizacionPeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -371,14 +215,8 @@ $this->modifiedColumns[] = OrganizacionPeer::CIUDAD; } - } // setCiudad() - - /** - * Set the value of [codigo_postal] column. - * - * @param string $v new value - * @return void - */ + } + public function setCodigoPostal($v) { @@ -387,14 +225,8 @@ $this->modifiedColumns[] = OrganizacionPeer::CODIGO_POSTAL; } - } // setCodigoPostal() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -403,14 +235,8 @@ $this->modifiedColumns[] = OrganizacionPeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [fk_provincia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkProvinciaId($v) { @@ -423,14 +249,8 @@ $this->aProvincia = null; } - } // setFkProvinciaId() - - /** - * Set the value of [fk_tipoiva_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipoivaId($v) { @@ -443,21 +263,8 @@ $this->aTipoiva = null; } - } // setFkTipoivaId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -488,23 +295,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 11; // 11 = OrganizacionPeer::NUM_COLUMNS - OrganizacionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 11; } catch (Exception $e) { throw new PropelException("Error populating Organizacion object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -526,16 +323,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -557,29 +345,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipoiva !== null) { if ($this->aTipoiva->isModified()) { $affectedRows += $this->aTipoiva->save($con); @@ -595,22 +368,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = OrganizacionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += OrganizacionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collEstablecimientos !== null) { foreach($this->collEstablecimientos as $referrerFK) { @@ -623,37 +390,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -666,16 +413,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -685,11 +423,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aTipoiva !== null) { if (!$this->aTipoiva->validate($columns)) { $failureMap = array_merge($failureMap, $this->aTipoiva->getValidationFailures()); @@ -723,28 +457,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = OrganizacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -784,19 +504,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = OrganizacionPeer::getFieldNames($keyType); @@ -816,30 +526,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = OrganizacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -876,25 +570,9 @@ case 10: $this->setFkTipoivaId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = OrganizacionPeer::getFieldNames($keyType); @@ -912,11 +590,7 @@ if (array_key_exists($keys[10], $arr)) $this->setFkTipoivaId($arr[$keys[10]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(OrganizacionPeer::DATABASE_NAME); @@ -936,14 +610,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(OrganizacionPeer::DATABASE_NAME); @@ -953,36 +620,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Organizacion (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1008,53 +658,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getEstablecimientos() as $relObj) { $copyObj->addEstablecimiento($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Organizacion Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return OrganizacionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1063,13 +689,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Tipoiva object. - * - * @param Tipoiva $v - * @return void - * @throws PropelException - */ + public function setTipoiva($v) { @@ -1085,42 +705,21 @@ } - /** - * Get the associated Tipoiva object - * - * @param Connection Optional Connection object. - * @return Tipoiva The associated Tipoiva object. - * @throws PropelException - */ + public function getTipoiva($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipoivaPeer.php'; + include_once 'lib/model/om/BaseTipoivaPeer.php'; if ($this->aTipoiva === null && ($this->fk_tipoiva_id !== null)) { $this->aTipoiva = TipoivaPeer::retrieveByPK($this->fk_tipoiva_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipoivaPeer::retrieveByPK($this->fk_tipoiva_id, $con); - $obj->addTipoivas($this); - */ + } return $this->aTipoiva; } - /** - * Declares an association between this object and a Provincia object. - * - * @param Provincia $v - * @return void - * @throws PropelException - */ + public function setProvincia($v) { @@ -1136,41 +735,21 @@ } - /** - * Get the associated Provincia object - * - * @param Connection Optional Connection object. - * @return Provincia The associated Provincia object. - * @throws PropelException - */ + public function getProvincia($con = null) { - // include the related Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($this->aProvincia === null && ($this->fk_provincia_id !== null)) { $this->aProvincia = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - $obj->addProvincias($this); - */ + } return $this->aProvincia; } - /** - * Temporary storage of collEstablecimientos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initEstablecimientos() { if ($this->collEstablecimientos === null) { @@ -1178,23 +757,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Organizacion has previously - * been saved, it will retrieve related Establecimientos from storage. - * If this Organizacion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getEstablecimientos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1214,13 +780,9 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(EstablecimientoPeer::FK_ORGANIZACION_ID, $this->getId()); EstablecimientoPeer::addSelectColumns($criteria); @@ -1233,18 +795,10 @@ return $this->collEstablecimientos; } - /** - * Returns the number of related Establecimientos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countEstablecimientos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1258,14 +812,7 @@ return EstablecimientoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Establecimiento object to this object - * through the Establecimiento foreign key attribute - * - * @param Establecimiento $l Establecimiento - * @return void - * @throws PropelException - */ + public function addEstablecimiento(Establecimiento $l) { $this->collEstablecimientos[] = $l; @@ -1273,21 +820,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Organizacion is new, it will return - * an empty collection; or if this Organizacion has previously - * been saved, it will retrieve related Establecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Organizacion. - */ + public function getEstablecimientosJoinNiveltipo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1306,10 +842,7 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinNiveltipo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EstablecimientoPeer::FK_ORGANIZACION_ID, $this->getId()); if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) { @@ -1322,21 +855,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Organizacion is new, it will return - * an empty collection; or if this Organizacion has previously - * been saved, it will retrieve related Establecimientos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Organizacion. - */ + public function getEstablecimientosJoinDistritoescolar($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1355,10 +877,7 @@ $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinDistritoescolar($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EstablecimientoPeer::FK_ORGANIZACION_ID, $this->getId()); if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) { @@ -1370,4 +889,4 @@ return $this->collEstablecimientos; } -} // BaseOrganizacion +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseOrganizacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,78 +1,62 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by OrganizacionPeer::getOMClass() -include_once 'model/Organizacion.php'; -/** - * Base static class for performing query and update operations on the 'organizacion' table. - * - * - * - * @package model.om - */ abstract class BaseOrganizacionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'organizacion'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Organizacion'; + + const CLASS_DEFAULT = 'lib.model.Organizacion'; - /** The total number of columns. */ + const NUM_COLUMNS = 11; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'organizacion.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'organizacion.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'organizacion.DESCRIPCION'; - /** the column name for the RAZON_SOCIAL field */ + const RAZON_SOCIAL = 'organizacion.RAZON_SOCIAL'; - /** the column name for the CUIT field */ + const CUIT = 'organizacion.CUIT'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'organizacion.DIRECCION'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'organizacion.CIUDAD'; - /** the column name for the CODIGO_POSTAL field */ + const CODIGO_POSTAL = 'organizacion.CODIGO_POSTAL'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'organizacion.TELEFONO'; - /** the column name for the FK_PROVINCIA_ID field */ + const FK_PROVINCIA_ID = 'organizacion.FK_PROVINCIA_ID'; - /** the column name for the FK_TIPOIVA_ID field */ + const FK_TIPOIVA_ID = 'organizacion.FK_TIPOIVA_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'RazonSocial', 'Cuit', 'Direccion', 'Ciudad', 'CodigoPostal', 'Telefono', 'FkProvinciaId', 'FkTipoivaId', ), BasePeer::TYPE_COLNAME => array (OrganizacionPeer::ID, OrganizacionPeer::NOMBRE, OrganizacionPeer::DESCRIPCION, OrganizacionPeer::RAZON_SOCIAL, OrganizacionPeer::CUIT, OrganizacionPeer::DIRECCION, OrganizacionPeer::CIUDAD, OrganizacionPeer::CODIGO_POSTAL, OrganizacionPeer::TELEFONO, OrganizacionPeer::FK_PROVINCIA_ID, OrganizacionPeer::FK_TIPOIVA_ID, ), @@ -80,12 +64,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'RazonSocial' => 3, 'Cuit' => 4, 'Direccion' => 5, 'Ciudad' => 6, 'CodigoPostal' => 7, 'Telefono' => 8, 'FkProvinciaId' => 9, 'FkTipoivaId' => 10, ), BasePeer::TYPE_COLNAME => array (OrganizacionPeer::ID => 0, OrganizacionPeer::NOMBRE => 1, OrganizacionPeer::DESCRIPCION => 2, OrganizacionPeer::RAZON_SOCIAL => 3, OrganizacionPeer::CUIT => 4, OrganizacionPeer::DIRECCION => 5, OrganizacionPeer::CIUDAD => 6, OrganizacionPeer::CODIGO_POSTAL => 7, OrganizacionPeer::TELEFONO => 8, OrganizacionPeer::FK_PROVINCIA_ID => 9, OrganizacionPeer::FK_TIPOIVA_ID => 10, ), @@ -93,24 +72,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/OrganizacionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.OrganizacionMapBuilder'); + include_once 'lib/model/map/OrganizacionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.OrganizacionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -124,15 +92,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -143,14 +103,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -160,34 +113,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. OrganizacionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(OrganizacionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -218,29 +150,19 @@ const COUNT = 'COUNT(organizacion.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT organizacion.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(OrganizacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(OrganizacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -249,19 +171,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Organizacion - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -272,33 +185,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return OrganizacionPeer::populateObjects(OrganizacionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -310,29 +202,18 @@ OrganizacionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = OrganizacionPeer::getOMClass(); + $cls = OrganizacionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -342,29 +223,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Tipoiva table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipoiva(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(OrganizacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(OrganizacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -375,35 +246,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(OrganizacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(OrganizacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -414,25 +274,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Organizacion objects pre-filled with their Tipoiva objects. - * - * @return array Array of Organizacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipoiva(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -460,37 +312,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipoiva(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoiva(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addOrganizacion($obj1); //CHECKME - break; + $temp_obj2->addOrganizacion($obj1); break; } } if ($newObject) { $obj2->initOrganizacions(); - $obj2->addOrganizacion($obj1); //CHECKME - } + $obj2->addOrganizacion($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Organizacion objects pre-filled with their Provincia objects. - * - * @return array Array of Organizacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -518,46 +359,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addOrganizacion($obj1); //CHECKME - break; + $temp_obj2->addOrganizacion($obj1); break; } } if ($newObject) { $obj2->initOrganizacions(); - $obj2->addOrganizacion($obj1); //CHECKME - } + $obj2->addOrganizacion($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(OrganizacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(OrganizacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -570,25 +398,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Organizacion objects pre-filled with all related objects. - * - * @return array Array of Organizacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -618,8 +438,7 @@ $obj1->hydrate($rs); - // Add objects for joined Tipoiva rows - + $omClass = TipoivaPeer::getOMClass(); @@ -630,11 +449,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoiva(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoiva(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addOrganizacion($obj1); // CHECKME - break; + $temp_obj2->addOrganizacion($obj1); break; } } @@ -644,8 +461,7 @@ } - // Add objects for joined Provincia rows - + $omClass = ProvinciaPeer::getOMClass(); @@ -656,11 +472,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getProvincia(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getProvincia(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addOrganizacion($obj1); // CHECKME - break; + $temp_obj3->addOrganizacion($obj1); break; } } @@ -675,29 +489,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Tipoiva table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipoiva(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(OrganizacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(OrganizacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -708,35 +512,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(OrganizacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(OrganizacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -747,27 +540,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Organizacion objects pre-filled with all related objects except Tipoiva. - * - * @return array Array of Organizacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipoiva(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -801,8 +584,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addOrganizacion($obj1); break; @@ -820,21 +602,12 @@ } - /** - * Selects a collection of Organizacion objects pre-filled with all related objects except Provincia. - * - * @return array Array of Organizacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -868,8 +641,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipoiva(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipoiva(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addOrganizacion($obj1); break; @@ -886,41 +658,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return OrganizacionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Organizacion or Criteria object. - * - * @param mixed $values Criteria or Organizacion object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -928,21 +678,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Organizacion object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(OrganizacionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(OrganizacionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -953,15 +697,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Organizacion or Criteria object. - * - * @param mixed $values Criteria or Organizacion object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -971,37 +707,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(OrganizacionPeer::ID); $selectCriteria->add(OrganizacionPeer::ID, $criteria->remove(OrganizacionPeer::ID), $comparison); - } else { // $values is Organizacion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the organizacion table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(OrganizacionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1011,17 +735,7 @@ } } - /** - * Method perform a DELETE on the database, given a Organizacion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Organizacion object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1029,25 +743,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Organizacion) { + $criteria = clone $values; } elseif ($values instanceof Organizacion) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(OrganizacionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1058,18 +766,7 @@ } } - /** - * Validates all modified columns of given Organizacion object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Organizacion $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Organizacion $obj, $cols = null) { $columns = array(); @@ -1104,13 +801,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Organizacion - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1127,14 +818,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1152,20 +836,14 @@ return $objs; } -} // BaseOrganizacionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseOrganizacionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/OrganizacionMapBuilder.php'; - Propel::registerMapBuilder('model.map.OrganizacionMapBuilder'); + require_once 'lib/model/map/OrganizacionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.OrganizacionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BasePais.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePais.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePais.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,148 +1,75 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/PaisPeer.php'; - -/** - * Base class that represents a row from the 'pais' table. - * - * - * - * @package model.om - */ abstract class BasePais extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var PaisPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre_largo field. - * @var string - */ + protected $nombre_largo = ''; - /** - * The value for the nombre_corto field. - * @var string - */ + protected $nombre_corto = ''; - /** - * The value for the orden field. - * @var int - */ + protected $orden = 0; - /** - * Collection to store aggregation of collProvincias. - * @var array - */ + protected $collProvincias; - /** - * The criteria used to select the current contents of collProvincias. - * @var Criteria - */ + protected $lastProvinciaCriteria = null; - /** - * Collection to store aggregation of collAlumnos. - * @var array - */ + protected $collAlumnos; - /** - * The criteria used to select the current contents of collAlumnos. - * @var Criteria - */ + protected $lastAlumnoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre_largo] column value. - * - * @return string - */ + public function getNombreLargo() { return $this->nombre_largo; } - /** - * Get the [nombre_corto] column value. - * - * @return string - */ + public function getNombreCorto() { return $this->nombre_corto; } - /** - * Get the [orden] column value. - * - * @return int - */ + public function getOrden() { return $this->orden; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -151,14 +78,8 @@ $this->modifiedColumns[] = PaisPeer::ID; } - } // setId() - - /** - * Set the value of [nombre_largo] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombreLargo($v) { @@ -167,14 +88,8 @@ $this->modifiedColumns[] = PaisPeer::NOMBRE_LARGO; } - } // setNombreLargo() - - /** - * Set the value of [nombre_corto] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombreCorto($v) { @@ -183,14 +98,8 @@ $this->modifiedColumns[] = PaisPeer::NOMBRE_CORTO; } - } // setNombreCorto() - - /** - * Set the value of [orden] column. - * - * @param int $v new value - * @return void - */ + } + public function setOrden($v) { @@ -199,21 +108,8 @@ $this->modifiedColumns[] = PaisPeer::ORDEN; } - } // setOrden() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -230,23 +126,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = PaisPeer::NUM_COLUMNS - PaisPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Pais object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -268,16 +154,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -299,40 +176,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = PaisPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += PaisPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collProvincias !== null) { foreach($this->collProvincias as $referrerFK) { @@ -353,37 +213,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -396,16 +236,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -443,28 +274,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = PaisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -483,19 +300,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = PaisPeer::getFieldNames($keyType); @@ -508,30 +315,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = PaisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -547,25 +338,9 @@ case 3: $this->setOrden($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = PaisPeer::getFieldNames($keyType); @@ -576,11 +351,7 @@ if (array_key_exists($keys[3], $arr)) $this->setOrden($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(PaisPeer::DATABASE_NAME); @@ -593,14 +364,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(PaisPeer::DATABASE_NAME); @@ -610,36 +374,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Pais (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -651,9 +398,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getProvincias() as $relObj) { $copyObj->addProvincia($relObj->copy($deepCopy)); @@ -663,45 +408,23 @@ $copyObj->addAlumno($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Pais Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return PaisPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -710,12 +433,7 @@ return self::$peer; } - /** - * Temporary storage of collProvincias to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initProvincias() { if ($this->collProvincias === null) { @@ -723,23 +441,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais has previously - * been saved, it will retrieve related Provincias from storage. - * If this Pais is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getProvincias($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -759,13 +464,9 @@ $this->collProvincias = ProvinciaPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ProvinciaPeer::FK_PAIS_ID, $this->getId()); ProvinciaPeer::addSelectColumns($criteria); @@ -778,18 +479,10 @@ return $this->collProvincias; } - /** - * Returns the number of related Provincias. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countProvincias($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -803,26 +496,14 @@ return ProvinciaPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Provincia object to this object - * through the Provincia foreign key attribute - * - * @param Provincia $l Provincia - * @return void - * @throws PropelException - */ + public function addProvincia(Provincia $l) { $this->collProvincias[] = $l; $l->setPais($this); } - /** - * Temporary storage of collAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAlumnos() { if ($this->collAlumnos === null) { @@ -830,23 +511,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais has previously - * been saved, it will retrieve related Alumnos from storage. - * If this Pais is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -866,13 +534,9 @@ $this->collAlumnos = AlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AlumnoPeer::FK_PAIS_ID, $this->getId()); AlumnoPeer::addSelectColumns($criteria); @@ -885,18 +549,10 @@ return $this->collAlumnos; } - /** - * Returns the number of related Alumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -910,14 +566,7 @@ return AlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Alumno object to this object - * through the Alumno foreign key attribute - * - * @param Alumno $l Alumno - * @return void - * @throws PropelException - */ + public function addAlumno(Alumno $l) { $this->collAlumnos[] = $l; @@ -925,21 +574,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais is new, it will return - * an empty collection; or if this Pais has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Pais. - */ + public function getAlumnosJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -958,10 +596,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PAIS_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -974,21 +609,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais is new, it will return - * an empty collection; or if this Pais has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Pais. - */ + public function getAlumnosJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1007,10 +631,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PAIS_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1023,21 +644,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais is new, it will return - * an empty collection; or if this Pais has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Pais. - */ + public function getAlumnosJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1056,10 +666,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PAIS_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1072,21 +679,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais is new, it will return - * an empty collection; or if this Pais has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Pais. - */ + public function getAlumnosJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1105,10 +701,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PAIS_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1121,21 +714,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Pais is new, it will return - * an empty collection; or if this Pais has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Pais. - */ + public function getAlumnosJoinConceptobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1154,10 +736,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinConceptobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PAIS_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1169,4 +748,4 @@ return $this->collAlumnos; } -} // BasePais +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BasePaisPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePaisPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePaisPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by PaisPeer::getOMClass() -include_once 'model/Pais.php'; -/** - * Base static class for performing query and update operations on the 'pais' table. - * - * - * - * @package model.om - */ abstract class BasePaisPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'pais'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Pais'; + + const CLASS_DEFAULT = 'lib.model.Pais'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'pais.ID'; - /** the column name for the NOMBRE_LARGO field */ + const NOMBRE_LARGO = 'pais.NOMBRE_LARGO'; - /** the column name for the NOMBRE_CORTO field */ + const NOMBRE_CORTO = 'pais.NOMBRE_CORTO'; - /** the column name for the ORDEN field */ + const ORDEN = 'pais.ORDEN'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'NombreLargo', 'NombreCorto', 'Orden', ), BasePeer::TYPE_COLNAME => array (PaisPeer::ID, PaisPeer::NOMBRE_LARGO, PaisPeer::NOMBRE_CORTO, PaisPeer::ORDEN, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'NombreLargo' => 1, 'NombreCorto' => 2, 'Orden' => 3, ), BasePeer::TYPE_COLNAME => array (PaisPeer::ID => 0, PaisPeer::NOMBRE_LARGO => 1, PaisPeer::NOMBRE_CORTO => 2, PaisPeer::ORDEN => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/PaisMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.PaisMapBuilder'); + include_once 'lib/model/map/PaisMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.PaisMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. PaisPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(PaisPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(pais.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT pais.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PaisPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PaisPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Pais - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return PaisPeer::populateObjects(PaisPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ PaisPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = PaisPeer::getOMClass(); + $cls = PaisPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -306,41 +187,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return PaisPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Pais or Criteria object. - * - * @param mixed $values Criteria or Pais object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -348,21 +207,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Pais object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(PaisPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(PaisPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -373,15 +226,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Pais or Criteria object. - * - * @param mixed $values Criteria or Pais object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -391,37 +236,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(PaisPeer::ID); $selectCriteria->add(PaisPeer::ID, $criteria->remove(PaisPeer::ID), $comparison); - } else { // $values is Pais object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the pais table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(PaisPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -431,17 +264,7 @@ } } - /** - * Method perform a DELETE on the database, given a Pais or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Pais object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -449,25 +272,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Pais) { + $criteria = clone $values; } elseif ($values instanceof Pais) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(PaisPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -478,18 +295,7 @@ } } - /** - * Validates all modified columns of given Pais object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Pais $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Pais $obj, $cols = null) { $columns = array(); @@ -524,13 +330,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Pais - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -547,14 +347,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -572,20 +365,14 @@ return $objs; } -} // BasePaisPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BasePaisPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/PaisMapBuilder.php'; - Propel::registerMapBuilder('model.map.PaisMapBuilder'); + require_once 'lib/model/map/PaisMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.PaisMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BasePeriodo.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePeriodo.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePeriodo.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,162 +1,82 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/PeriodoPeer.php'; - -/** - * Base class that represents a row from the 'periodo' table. - * - * - * - * @package model.om - */ abstract class BasePeriodo extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var PeriodoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_ciclolectivo_id field. - * @var int - */ + protected $fk_ciclolectivo_id; - /** - * The value for the fecha_inicio field. - * @var int - */ + protected $fecha_inicio; - /** - * The value for the fecha_fin field. - * @var int - */ + protected $fecha_fin; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * @var Ciclolectivo - */ + protected $aCiclolectivo; - /** - * Collection to store aggregation of collBoletinConceptuals. - * @var array - */ + protected $collBoletinConceptuals; - /** - * The criteria used to select the current contents of collBoletinConceptuals. - * @var Criteria - */ + protected $lastBoletinConceptualCriteria = null; - /** - * Collection to store aggregation of collBoletinActividadess. - * @var array - */ + protected $collBoletinActividadess; - /** - * The criteria used to select the current contents of collBoletinActividadess. - * @var Criteria - */ + protected $lastBoletinActividadesCriteria = null; - /** - * Collection to store aggregation of collExamens. - * @var array - */ + protected $collExamens; - /** - * The criteria used to select the current contents of collExamens. - * @var Criteria - */ + protected $lastExamenCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_ciclolectivo_id] column value. - * - * @return int - */ + public function getFkCiclolectivoId() { return $this->fk_ciclolectivo_id; } - /** - * Get the [optionally formatted] [fecha_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaInicio($format = 'Y-m-d H:i:s') { if ($this->fecha_inicio === null || $this->fecha_inicio === '') { return null; } elseif (!is_int($this->fecha_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); + $ts = strtotime($this->fecha_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); } } else { $ts = $this->fecha_inicio; @@ -170,24 +90,15 @@ } } - /** - * Get the [optionally formatted] [fecha_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaFin($format = 'Y-m-d H:i:s') { if ($this->fecha_fin === null || $this->fecha_fin === '') { return null; } elseif (!is_int($this->fecha_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); + $ts = strtotime($this->fecha_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); } } else { $ts = $this->fecha_fin; @@ -201,23 +112,14 @@ } } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -226,14 +128,8 @@ $this->modifiedColumns[] = PeriodoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_ciclolectivo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCiclolectivoId($v) { @@ -246,21 +142,14 @@ $this->aCiclolectivo = null; } - } // setFkCiclolectivoId() - - /** - * Set the value of [fecha_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -270,21 +159,14 @@ $this->modifiedColumns[] = PeriodoPeer::FECHA_INICIO; } - } // setFechaInicio() - - /** - * Set the value of [fecha_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -294,14 +176,8 @@ $this->modifiedColumns[] = PeriodoPeer::FECHA_FIN; } - } // setFechaFin() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -310,21 +186,8 @@ $this->modifiedColumns[] = PeriodoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -343,23 +206,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = PeriodoPeer::NUM_COLUMNS - PeriodoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Periodo object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -381,16 +234,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -412,29 +256,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCiclolectivo !== null) { if ($this->aCiclolectivo->isModified()) { $affectedRows += $this->aCiclolectivo->save($con); @@ -443,22 +272,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = PeriodoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += PeriodoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collBoletinConceptuals !== null) { foreach($this->collBoletinConceptuals as $referrerFK) { @@ -487,37 +310,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -530,16 +333,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -549,11 +343,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCiclolectivo !== null) { if (!$this->aCiclolectivo->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCiclolectivo->getValidationFailures()); @@ -597,28 +387,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = PeriodoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -640,19 +416,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = PeriodoPeer::getFieldNames($keyType); @@ -666,30 +432,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = PeriodoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -708,25 +458,9 @@ case 4: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = PeriodoPeer::getFieldNames($keyType); @@ -738,11 +472,7 @@ if (array_key_exists($keys[4], $arr)) $this->setDescripcion($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(PeriodoPeer::DATABASE_NAME); @@ -756,14 +486,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(PeriodoPeer::DATABASE_NAME); @@ -773,36 +496,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Periodo (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -816,9 +522,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getBoletinConceptuals() as $relObj) { $copyObj->addBoletinConceptual($relObj->copy($deepCopy)); @@ -832,45 +536,23 @@ $copyObj->addExamen($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Periodo Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return PeriodoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -879,13 +561,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Ciclolectivo object. - * - * @param Ciclolectivo $v - * @return void - * @throws PropelException - */ + public function setCiclolectivo($v) { @@ -901,41 +577,21 @@ } - /** - * Get the associated Ciclolectivo object - * - * @param Connection Optional Connection object. - * @return Ciclolectivo The associated Ciclolectivo object. - * @throws PropelException - */ + public function getCiclolectivo($con = null) { - // include the related Peer class - include_once 'model/om/BaseCiclolectivoPeer.php'; + include_once 'lib/model/om/BaseCiclolectivoPeer.php'; if ($this->aCiclolectivo === null && ($this->fk_ciclolectivo_id !== null)) { $this->aCiclolectivo = CiclolectivoPeer::retrieveByPK($this->fk_ciclolectivo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CiclolectivoPeer::retrieveByPK($this->fk_ciclolectivo_id, $con); - $obj->addCiclolectivos($this); - */ + } return $this->aCiclolectivo; } - /** - * Temporary storage of collBoletinConceptuals to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinConceptuals() { if ($this->collBoletinConceptuals === null) { @@ -943,23 +599,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * If this Periodo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinConceptuals($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -979,13 +622,9 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinConceptualPeer::FK_PERIODO_ID, $this->getId()); BoletinConceptualPeer::addSelectColumns($criteria); @@ -998,18 +637,10 @@ return $this->collBoletinConceptuals; } - /** - * Returns the number of related BoletinConceptuals. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinConceptuals($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1023,14 +654,7 @@ return BoletinConceptualPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinConceptual object to this object - * through the BoletinConceptual foreign key attribute - * - * @param BoletinConceptual $l BoletinConceptual - * @return void - * @throws PropelException - */ + public function addBoletinConceptual(BoletinConceptual $l) { $this->collBoletinConceptuals[] = $l; @@ -1038,21 +662,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getBoletinConceptualsJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1071,10 +684,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1087,21 +697,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getBoletinConceptualsJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1120,10 +719,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1136,21 +732,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related BoletinConceptuals from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getBoletinConceptualsJoinConcepto($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinConceptualPeer.php'; + include_once 'lib/model/om/BaseBoletinConceptualPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1169,10 +754,7 @@ $this->collBoletinConceptuals = BoletinConceptualPeer::doSelectJoinConcepto($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinConceptualPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastBoletinConceptualCriteria) || !$this->lastBoletinConceptualCriteria->equals($criteria)) { @@ -1184,12 +766,7 @@ return $this->collBoletinConceptuals; } - /** - * Temporary storage of collBoletinActividadess to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initBoletinActividadess() { if ($this->collBoletinActividadess === null) { @@ -1197,23 +774,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * If this Periodo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getBoletinActividadess($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1233,13 +797,9 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(BoletinActividadesPeer::FK_PERIODO_ID, $this->getId()); BoletinActividadesPeer::addSelectColumns($criteria); @@ -1252,18 +812,10 @@ return $this->collBoletinActividadess; } - /** - * Returns the number of related BoletinActividadess. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countBoletinActividadess($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1277,14 +829,7 @@ return BoletinActividadesPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a BoletinActividades object to this object - * through the BoletinActividades foreign key attribute - * - * @param BoletinActividades $l BoletinActividades - * @return void - * @throws PropelException - */ + public function addBoletinActividades(BoletinActividades $l) { $this->collBoletinActividadess[] = $l; @@ -1292,21 +837,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getBoletinActividadessJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1325,10 +859,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1341,21 +872,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getBoletinActividadessJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1374,10 +894,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1390,21 +907,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related BoletinActividadess from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getBoletinActividadessJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseBoletinActividadesPeer.php'; + include_once 'lib/model/om/BaseBoletinActividadesPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1423,10 +929,7 @@ $this->collBoletinActividadess = BoletinActividadesPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(BoletinActividadesPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastBoletinActividadesCriteria) || !$this->lastBoletinActividadesCriteria->equals($criteria)) { @@ -1438,12 +941,7 @@ return $this->collBoletinActividadess; } - /** - * Temporary storage of collExamens to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initExamens() { if ($this->collExamens === null) { @@ -1451,23 +949,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo has previously - * been saved, it will retrieve related Examens from storage. - * If this Periodo is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getExamens($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1487,13 +972,9 @@ $this->collExamens = ExamenPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ExamenPeer::FK_PERIODO_ID, $this->getId()); ExamenPeer::addSelectColumns($criteria); @@ -1506,18 +987,10 @@ return $this->collExamens; } - /** - * Returns the number of related Examens. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countExamens($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1531,14 +1004,7 @@ return ExamenPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Examen object to this object - * through the Examen foreign key attribute - * - * @param Examen $l Examen - * @return void - * @throws PropelException - */ + public function addExamen(Examen $l) { $this->collExamens[] = $l; @@ -1546,21 +1012,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getExamensJoinEscalanota($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1579,10 +1034,7 @@ $this->collExamens = ExamenPeer::doSelectJoinEscalanota($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1595,21 +1047,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getExamensJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1628,10 +1069,7 @@ $this->collExamens = ExamenPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1644,21 +1082,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Periodo is new, it will return - * an empty collection; or if this Periodo has previously - * been saved, it will retrieve related Examens from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Periodo. - */ + public function getExamensJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseExamenPeer.php'; + include_once 'lib/model/om/BaseExamenPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1677,10 +1104,7 @@ $this->collExamens = ExamenPeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ExamenPeer::FK_PERIODO_ID, $this->getId()); if (!isset($this->lastExamenCriteria) || !$this->lastExamenCriteria->equals($criteria)) { @@ -1692,4 +1116,4 @@ return $this->collExamens; } -} // BasePeriodo +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BasePeriodoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePeriodoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePeriodoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by PeriodoPeer::getOMClass() -include_once 'model/Periodo.php'; -/** - * Base static class for performing query and update operations on the 'periodo' table. - * - * - * - * @package model.om - */ abstract class BasePeriodoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'periodo'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Periodo'; + + const CLASS_DEFAULT = 'lib.model.Periodo'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'periodo.ID'; - /** the column name for the FK_CICLOLECTIVO_ID field */ + const FK_CICLOLECTIVO_ID = 'periodo.FK_CICLOLECTIVO_ID'; - /** the column name for the FECHA_INICIO field */ + const FECHA_INICIO = 'periodo.FECHA_INICIO'; - /** the column name for the FECHA_FIN field */ + const FECHA_FIN = 'periodo.FECHA_FIN'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'periodo.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkCiclolectivoId', 'FechaInicio', 'FechaFin', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (PeriodoPeer::ID, PeriodoPeer::FK_CICLOLECTIVO_ID, PeriodoPeer::FECHA_INICIO, PeriodoPeer::FECHA_FIN, PeriodoPeer::DESCRIPCION, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkCiclolectivoId' => 1, 'FechaInicio' => 2, 'FechaFin' => 3, 'Descripcion' => 4, ), BasePeer::TYPE_COLNAME => array (PeriodoPeer::ID => 0, PeriodoPeer::FK_CICLOLECTIVO_ID => 1, PeriodoPeer::FECHA_INICIO => 2, PeriodoPeer::FECHA_FIN => 3, PeriodoPeer::DESCRIPCION => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/PeriodoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.PeriodoMapBuilder'); + include_once 'lib/model/map/PeriodoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.PeriodoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. PeriodoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(PeriodoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(periodo.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT periodo.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PeriodoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PeriodoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Periodo - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return PeriodoPeer::populateObjects(PeriodoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ PeriodoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = PeriodoPeer::getOMClass(); + $cls = PeriodoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -312,29 +193,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Ciclolectivo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCiclolectivo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PeriodoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PeriodoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -345,25 +216,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Periodo objects pre-filled with their Ciclolectivo objects. - * - * @return array Array of Periodo objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCiclolectivo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -391,46 +254,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCiclolectivo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCiclolectivo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addPeriodo($obj1); //CHECKME - break; + $temp_obj2->addPeriodo($obj1); break; } } if ($newObject) { $obj2->initPeriodos(); - $obj2->addPeriodo($obj1); //CHECKME - } + $obj2->addPeriodo($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PeriodoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PeriodoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -441,25 +291,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Periodo objects pre-filled with all related objects. - * - * @return array Array of Periodo objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -484,8 +326,7 @@ $obj1->hydrate($rs); - // Add objects for joined Ciclolectivo rows - + $omClass = CiclolectivoPeer::getOMClass(); @@ -496,11 +337,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCiclolectivo(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCiclolectivo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addPeriodo($obj1); // CHECKME - break; + $temp_obj2->addPeriodo($obj1); break; } } @@ -514,41 +353,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return PeriodoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Periodo or Criteria object. - * - * @param mixed $values Criteria or Periodo object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -556,21 +373,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Periodo object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(PeriodoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(PeriodoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -581,15 +392,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Periodo or Criteria object. - * - * @param mixed $values Criteria or Periodo object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -599,37 +402,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(PeriodoPeer::ID); $selectCriteria->add(PeriodoPeer::ID, $criteria->remove(PeriodoPeer::ID), $comparison); - } else { // $values is Periodo object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the periodo table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(PeriodoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -639,17 +430,7 @@ } } - /** - * Method perform a DELETE on the database, given a Periodo or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Periodo object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -657,25 +438,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Periodo) { + $criteria = clone $values; } elseif ($values instanceof Periodo) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(PeriodoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -686,18 +461,7 @@ } } - /** - * Validates all modified columns of given Periodo object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Periodo $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Periodo $obj, $cols = null) { $columns = array(); @@ -732,13 +496,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Periodo - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -755,14 +513,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -780,20 +531,14 @@ return $objs; } -} // BasePeriodoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BasePeriodoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/PeriodoMapBuilder.php'; - Propel::registerMapBuilder('model.map.PeriodoMapBuilder'); + require_once 'lib/model/map/PeriodoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.PeriodoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BasePermiso.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePermiso.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePermiso.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,171 +1,89 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/PermisoPeer.php'; - -/** - * Base class that represents a row from the 'permiso' table. - * - * - * - * @package model.om - */ abstract class BasePermiso extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var PermisoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion; - /** - * The value for the fk_modulo_id field. - * @var int - */ + protected $fk_modulo_id = 0; - /** - * The value for the credencial field. - * @var string - */ + protected $credencial; - /** - * @var Modulo - */ + protected $aModulo; - /** - * Collection to store aggregation of collRelRolPermisos. - * @var array - */ + protected $collRelRolPermisos; - /** - * The criteria used to select the current contents of collRelRolPermisos. - * @var Criteria - */ + protected $lastRelRolPermisoCriteria = null; - /** - * Collection to store aggregation of collRelUsuarioPermisos. - * @var array - */ + protected $collRelUsuarioPermisos; - /** - * The criteria used to select the current contents of collRelUsuarioPermisos. - * @var Criteria - */ + protected $lastRelUsuarioPermisoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [fk_modulo_id] column value. - * - * @return int - */ + public function getFkModuloId() { return $this->fk_modulo_id; } - /** - * Get the [credencial] column value. - * - * @return string - */ + public function getCredencial() { return $this->credencial; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -174,14 +92,8 @@ $this->modifiedColumns[] = PermisoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -190,14 +102,8 @@ $this->modifiedColumns[] = PermisoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -206,14 +112,8 @@ $this->modifiedColumns[] = PermisoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [fk_modulo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkModuloId($v) { @@ -226,14 +126,8 @@ $this->aModulo = null; } - } // setFkModuloId() - - /** - * Set the value of [credencial] column. - * - * @param string $v new value - * @return void - */ + } + public function setCredencial($v) { @@ -242,21 +136,8 @@ $this->modifiedColumns[] = PermisoPeer::CREDENCIAL; } - } // setCredencial() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -275,23 +156,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = PermisoPeer::NUM_COLUMNS - PermisoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Permiso object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -313,16 +184,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -344,29 +206,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aModulo !== null) { if ($this->aModulo->isModified()) { $affectedRows += $this->aModulo->save($con); @@ -375,22 +222,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = PermisoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += PermisoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelRolPermisos !== null) { foreach($this->collRelRolPermisos as $referrerFK) { @@ -411,37 +252,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -454,16 +275,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -473,11 +285,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aModulo !== null) { if (!$this->aModulo->validate($columns)) { $failureMap = array_merge($failureMap, $this->aModulo->getValidationFailures()); @@ -513,28 +321,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = PermisoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -556,19 +350,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = PermisoPeer::getFieldNames($keyType); @@ -582,30 +366,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = PermisoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -624,25 +392,9 @@ case 4: $this->setCredencial($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = PermisoPeer::getFieldNames($keyType); @@ -654,11 +406,7 @@ if (array_key_exists($keys[4], $arr)) $this->setCredencial($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(PermisoPeer::DATABASE_NAME); @@ -672,14 +420,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(PermisoPeer::DATABASE_NAME); @@ -689,36 +430,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Permiso (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -732,9 +456,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelRolPermisos() as $relObj) { $copyObj->addRelRolPermiso($relObj->copy($deepCopy)); @@ -744,45 +466,23 @@ $copyObj->addRelUsuarioPermiso($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Permiso Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return PermisoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -791,13 +491,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Modulo object. - * - * @param Modulo $v - * @return void - * @throws PropelException - */ + public function setModulo($v) { @@ -813,41 +507,21 @@ } - /** - * Get the associated Modulo object - * - * @param Connection Optional Connection object. - * @return Modulo The associated Modulo object. - * @throws PropelException - */ + public function getModulo($con = null) { - // include the related Peer class - include_once 'model/om/BaseModuloPeer.php'; + include_once 'lib/model/om/BaseModuloPeer.php'; if ($this->aModulo === null && ($this->fk_modulo_id !== null)) { $this->aModulo = ModuloPeer::retrieveByPK($this->fk_modulo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ModuloPeer::retrieveByPK($this->fk_modulo_id, $con); - $obj->addModulos($this); - */ + } return $this->aModulo; } - /** - * Temporary storage of collRelRolPermisos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelRolPermisos() { if ($this->collRelRolPermisos === null) { @@ -855,23 +529,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Permiso has previously - * been saved, it will retrieve related RelRolPermisos from storage. - * If this Permiso is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelRolPermisos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelRolPermisoPeer.php'; + include_once 'lib/model/om/BaseRelRolPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -891,13 +552,9 @@ $this->collRelRolPermisos = RelRolPermisoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelRolPermisoPeer::FK_PERMISO_ID, $this->getId()); RelRolPermisoPeer::addSelectColumns($criteria); @@ -910,18 +567,10 @@ return $this->collRelRolPermisos; } - /** - * Returns the number of related RelRolPermisos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelRolPermisos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelRolPermisoPeer.php'; + include_once 'lib/model/om/BaseRelRolPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -935,14 +584,7 @@ return RelRolPermisoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelRolPermiso object to this object - * through the RelRolPermiso foreign key attribute - * - * @param RelRolPermiso $l RelRolPermiso - * @return void - * @throws PropelException - */ + public function addRelRolPermiso(RelRolPermiso $l) { $this->collRelRolPermisos[] = $l; @@ -950,21 +592,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Permiso is new, it will return - * an empty collection; or if this Permiso has previously - * been saved, it will retrieve related RelRolPermisos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Permiso. - */ + public function getRelRolPermisosJoinRol($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelRolPermisoPeer.php'; + include_once 'lib/model/om/BaseRelRolPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -983,10 +614,7 @@ $this->collRelRolPermisos = RelRolPermisoPeer::doSelectJoinRol($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelRolPermisoPeer::FK_PERMISO_ID, $this->getId()); if (!isset($this->lastRelRolPermisoCriteria) || !$this->lastRelRolPermisoCriteria->equals($criteria)) { @@ -998,12 +626,7 @@ return $this->collRelRolPermisos; } - /** - * Temporary storage of collRelUsuarioPermisos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelUsuarioPermisos() { if ($this->collRelUsuarioPermisos === null) { @@ -1011,23 +634,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Permiso has previously - * been saved, it will retrieve related RelUsuarioPermisos from storage. - * If this Permiso is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelUsuarioPermisos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + include_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1047,13 +657,9 @@ $this->collRelUsuarioPermisos = RelUsuarioPermisoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelUsuarioPermisoPeer::FK_PERMISO_ID, $this->getId()); RelUsuarioPermisoPeer::addSelectColumns($criteria); @@ -1066,18 +672,10 @@ return $this->collRelUsuarioPermisos; } - /** - * Returns the number of related RelUsuarioPermisos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelUsuarioPermisos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + include_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1091,14 +689,7 @@ return RelUsuarioPermisoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelUsuarioPermiso object to this object - * through the RelUsuarioPermiso foreign key attribute - * - * @param RelUsuarioPermiso $l RelUsuarioPermiso - * @return void - * @throws PropelException - */ + public function addRelUsuarioPermiso(RelUsuarioPermiso $l) { $this->collRelUsuarioPermisos[] = $l; @@ -1106,21 +697,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Permiso is new, it will return - * an empty collection; or if this Permiso has previously - * been saved, it will retrieve related RelUsuarioPermisos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Permiso. - */ + public function getRelUsuarioPermisosJoinUsuario($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + include_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1139,10 +719,7 @@ $this->collRelUsuarioPermisos = RelUsuarioPermisoPeer::doSelectJoinUsuario($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelUsuarioPermisoPeer::FK_PERMISO_ID, $this->getId()); if (!isset($this->lastRelUsuarioPermisoCriteria) || !$this->lastRelUsuarioPermisoCriteria->equals($criteria)) { @@ -1154,4 +731,4 @@ return $this->collRelUsuarioPermisos; } -} // BasePermiso +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BasePermisoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePermisoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePermisoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by PermisoPeer::getOMClass() -include_once 'model/Permiso.php'; -/** - * Base static class for performing query and update operations on the 'permiso' table. - * - * - * - * @package model.om - */ abstract class BasePermisoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'permiso'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Permiso'; + + const CLASS_DEFAULT = 'lib.model.Permiso'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'permiso.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'permiso.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'permiso.DESCRIPCION'; - /** the column name for the FK_MODULO_ID field */ + const FK_MODULO_ID = 'permiso.FK_MODULO_ID'; - /** the column name for the CREDENCIAL field */ + const CREDENCIAL = 'permiso.CREDENCIAL'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'FkModuloId', 'Credencial', ), BasePeer::TYPE_COLNAME => array (PermisoPeer::ID, PermisoPeer::NOMBRE, PermisoPeer::DESCRIPCION, PermisoPeer::FK_MODULO_ID, PermisoPeer::CREDENCIAL, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'FkModuloId' => 3, 'Credencial' => 4, ), BasePeer::TYPE_COLNAME => array (PermisoPeer::ID => 0, PermisoPeer::NOMBRE => 1, PermisoPeer::DESCRIPCION => 2, PermisoPeer::FK_MODULO_ID => 3, PermisoPeer::CREDENCIAL => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/PermisoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.PermisoMapBuilder'); + include_once 'lib/model/map/PermisoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.PermisoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. PermisoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(PermisoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(permiso.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT permiso.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Permiso - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return PermisoPeer::populateObjects(PermisoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ PermisoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = PermisoPeer::getOMClass(); + $cls = PermisoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -312,29 +193,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Modulo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinModulo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -345,25 +216,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Permiso objects pre-filled with their Modulo objects. - * - * @return array Array of Permiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinModulo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -391,46 +254,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getModulo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getModulo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addPermiso($obj1); //CHECKME - break; + $temp_obj2->addPermiso($obj1); break; } } if ($newObject) { $obj2->initPermisos(); - $obj2->addPermiso($obj1); //CHECKME - } + $obj2->addPermiso($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -441,25 +291,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Permiso objects pre-filled with all related objects. - * - * @return array Array of Permiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -484,8 +326,7 @@ $obj1->hydrate($rs); - // Add objects for joined Modulo rows - + $omClass = ModuloPeer::getOMClass(); @@ -496,11 +337,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getModulo(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getModulo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addPermiso($obj1); // CHECKME - break; + $temp_obj2->addPermiso($obj1); break; } } @@ -514,41 +353,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return PermisoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Permiso or Criteria object. - * - * @param mixed $values Criteria or Permiso object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -556,21 +373,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Permiso object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(PermisoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(PermisoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -581,15 +392,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Permiso or Criteria object. - * - * @param mixed $values Criteria or Permiso object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -599,37 +402,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(PermisoPeer::ID); $selectCriteria->add(PermisoPeer::ID, $criteria->remove(PermisoPeer::ID), $comparison); - } else { // $values is Permiso object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the permiso table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(PermisoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -639,17 +430,7 @@ } } - /** - * Method perform a DELETE on the database, given a Permiso or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Permiso object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -657,25 +438,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Permiso) { + $criteria = clone $values; } elseif ($values instanceof Permiso) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(PermisoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -686,18 +461,7 @@ } } - /** - * Validates all modified columns of given Permiso object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Permiso $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Permiso $obj, $cols = null) { $columns = array(); @@ -732,13 +496,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Permiso - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -755,14 +513,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -780,20 +531,14 @@ return $objs; } -} // BasePermisoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BasePermisoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/PermisoMapBuilder.php'; - Propel::registerMapBuilder('model.map.PermisoMapBuilder'); + require_once 'lib/model/map/PermisoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.PermisoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BasePreferencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePreferencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePreferencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,124 +1,63 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/PreferenciaPeer.php'; - -/** - * Base class that represents a row from the 'preferencia' table. - * - * - * - * @package model.om - */ abstract class BasePreferencia extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var PreferenciaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the valor_por_defecto field. - * @var string - */ + protected $valor_por_defecto; - /** - * The value for the activo field. - * @var boolean - */ + protected $activo = true; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [valor_por_defecto] column value. - * - * @return string - */ + public function getValorPorDefecto() { return $this->valor_por_defecto; } - /** - * Get the [activo] column value. - * - * @return boolean - */ + public function getActivo() { return $this->activo; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -127,14 +66,8 @@ $this->modifiedColumns[] = PreferenciaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -143,14 +76,8 @@ $this->modifiedColumns[] = PreferenciaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [valor_por_defecto] column. - * - * @param string $v new value - * @return void - */ + } + public function setValorPorDefecto($v) { @@ -159,14 +86,8 @@ $this->modifiedColumns[] = PreferenciaPeer::VALOR_POR_DEFECTO; } - } // setValorPorDefecto() - - /** - * Set the value of [activo] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActivo($v) { @@ -175,21 +96,8 @@ $this->modifiedColumns[] = PreferenciaPeer::ACTIVO; } - } // setActivo() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -206,23 +114,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = PreferenciaPeer::NUM_COLUMNS - PreferenciaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Preferencia object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -244,16 +142,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -275,75 +164,38 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = PreferenciaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += PreferenciaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -356,16 +208,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -387,28 +230,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = PreferenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -427,19 +256,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = PreferenciaPeer::getFieldNames($keyType); @@ -452,30 +271,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = PreferenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -491,25 +294,9 @@ case 3: $this->setActivo($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = PreferenciaPeer::getFieldNames($keyType); @@ -520,11 +307,7 @@ if (array_key_exists($keys[3], $arr)) $this->setActivo($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(PreferenciaPeer::DATABASE_NAME); @@ -537,14 +320,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(PreferenciaPeer::DATABASE_NAME); @@ -554,36 +330,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Preferencia (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -596,40 +355,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Preferencia Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return PreferenciaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -638,4 +376,4 @@ return self::$peer; } -} // BasePreferencia +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BasePreferenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BasePreferenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BasePreferenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by PreferenciaPeer::getOMClass() -include_once 'model/Preferencia.php'; -/** - * Base static class for performing query and update operations on the 'preferencia' table. - * - * - * - * @package model.om - */ abstract class BasePreferenciaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'preferencia'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Preferencia'; + + const CLASS_DEFAULT = 'lib.model.Preferencia'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'preferencia.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'preferencia.NOMBRE'; - /** the column name for the VALOR_POR_DEFECTO field */ + const VALOR_POR_DEFECTO = 'preferencia.VALOR_POR_DEFECTO'; - /** the column name for the ACTIVO field */ + const ACTIVO = 'preferencia.ACTIVO'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'ValorPorDefecto', 'Activo', ), BasePeer::TYPE_COLNAME => array (PreferenciaPeer::ID, PreferenciaPeer::NOMBRE, PreferenciaPeer::VALOR_POR_DEFECTO, PreferenciaPeer::ACTIVO, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'ValorPorDefecto' => 2, 'Activo' => 3, ), BasePeer::TYPE_COLNAME => array (PreferenciaPeer::ID => 0, PreferenciaPeer::NOMBRE => 1, PreferenciaPeer::VALOR_POR_DEFECTO => 2, PreferenciaPeer::ACTIVO => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/PreferenciaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.PreferenciaMapBuilder'); + include_once 'lib/model/map/PreferenciaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.PreferenciaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. PreferenciaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(PreferenciaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(preferencia.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT preferencia.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(PreferenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(PreferenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Preferencia - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return PreferenciaPeer::populateObjects(PreferenciaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ PreferenciaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = PreferenciaPeer::getOMClass(); + $cls = PreferenciaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -306,41 +187,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return PreferenciaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Preferencia or Criteria object. - * - * @param mixed $values Criteria or Preferencia object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -348,21 +207,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Preferencia object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(PreferenciaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(PreferenciaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -373,15 +226,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Preferencia or Criteria object. - * - * @param mixed $values Criteria or Preferencia object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -391,37 +236,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(PreferenciaPeer::ID); $selectCriteria->add(PreferenciaPeer::ID, $criteria->remove(PreferenciaPeer::ID), $comparison); - } else { // $values is Preferencia object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the preferencia table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(PreferenciaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -431,17 +264,7 @@ } } - /** - * Method perform a DELETE on the database, given a Preferencia or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Preferencia object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -449,25 +272,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Preferencia) { + $criteria = clone $values; } elseif ($values instanceof Preferencia) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(PreferenciaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -478,18 +295,7 @@ } } - /** - * Validates all modified columns of given Preferencia object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Preferencia $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Preferencia $obj, $cols = null) { $columns = array(); @@ -524,13 +330,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Preferencia - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -547,14 +347,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -572,20 +365,14 @@ return $objs; } -} // BasePreferenciaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BasePreferenciaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/PreferenciaMapBuilder.php'; - Propel::registerMapBuilder('model.map.PreferenciaMapBuilder'); + require_once 'lib/model/map/PreferenciaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.PreferenciaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseProvincia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseProvincia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseProvincia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,219 +1,113 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ProvinciaPeer.php'; - -/** - * Base class that represents a row from the 'provincia' table. - * - * - * - * @package model.om - */ abstract class BaseProvincia extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ProvinciaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre_corto field. - * @var string - */ + protected $nombre_corto = ''; - /** - * The value for the nombre_largo field. - * @var string - */ + protected $nombre_largo = ''; - /** - * The value for the fk_pais_id field. - * @var int - */ + protected $fk_pais_id = 0; - /** - * The value for the orden field. - * @var int - */ + protected $orden = 0; - /** - * @var Pais - */ + protected $aPais; - /** - * Collection to store aggregation of collLocacions. - * @var array - */ + protected $collLocacions; - /** - * The criteria used to select the current contents of collLocacions. - * @var Criteria - */ + protected $lastLocacionCriteria = null; - /** - * Collection to store aggregation of collOrganizacions. - * @var array - */ + protected $collOrganizacions; - /** - * The criteria used to select the current contents of collOrganizacions. - * @var Criteria - */ + protected $lastOrganizacionCriteria = null; - /** - * Collection to store aggregation of collCuentas. - * @var array - */ + protected $collCuentas; - /** - * The criteria used to select the current contents of collCuentas. - * @var Criteria - */ + protected $lastCuentaCriteria = null; - /** - * Collection to store aggregation of collAlumnos. - * @var array - */ + protected $collAlumnos; - /** - * The criteria used to select the current contents of collAlumnos. - * @var Criteria - */ + protected $lastAlumnoCriteria = null; - /** - * Collection to store aggregation of collResponsables. - * @var array - */ + protected $collResponsables; - /** - * The criteria used to select the current contents of collResponsables. - * @var Criteria - */ + protected $lastResponsableCriteria = null; - /** - * Collection to store aggregation of collDocentes. - * @var array - */ + protected $collDocentes; - /** - * The criteria used to select the current contents of collDocentes. - * @var Criteria - */ + protected $lastDocenteCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre_corto] column value. - * - * @return string - */ + public function getNombreCorto() { return $this->nombre_corto; } - /** - * Get the [nombre_largo] column value. - * - * @return string - */ + public function getNombreLargo() { return $this->nombre_largo; } - /** - * Get the [fk_pais_id] column value. - * - * @return int - */ + public function getFkPaisId() { return $this->fk_pais_id; } - /** - * Get the [orden] column value. - * - * @return int - */ + public function getOrden() { return $this->orden; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -222,14 +116,8 @@ $this->modifiedColumns[] = ProvinciaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre_corto] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombreCorto($v) { @@ -238,14 +126,8 @@ $this->modifiedColumns[] = ProvinciaPeer::NOMBRE_CORTO; } - } // setNombreCorto() - - /** - * Set the value of [nombre_largo] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombreLargo($v) { @@ -254,14 +136,8 @@ $this->modifiedColumns[] = ProvinciaPeer::NOMBRE_LARGO; } - } // setNombreLargo() - - /** - * Set the value of [fk_pais_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPaisId($v) { @@ -274,14 +150,8 @@ $this->aPais = null; } - } // setFkPaisId() - - /** - * Set the value of [orden] column. - * - * @param int $v new value - * @return void - */ + } + public function setOrden($v) { @@ -290,21 +160,8 @@ $this->modifiedColumns[] = ProvinciaPeer::ORDEN; } - } // setOrden() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -323,23 +180,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = ProvinciaPeer::NUM_COLUMNS - ProvinciaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Provincia object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -361,16 +208,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -392,29 +230,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aPais !== null) { if ($this->aPais->isModified()) { $affectedRows += $this->aPais->save($con); @@ -423,22 +246,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ProvinciaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ProvinciaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collLocacions !== null) { foreach($this->collLocacions as $referrerFK) { @@ -491,37 +308,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -534,16 +331,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -553,11 +341,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aPais !== null) { if (!$this->aPais->validate($columns)) { $failureMap = array_merge($failureMap, $this->aPais->getValidationFailures()); @@ -625,28 +409,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ProvinciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -668,19 +438,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ProvinciaPeer::getFieldNames($keyType); @@ -694,30 +454,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ProvinciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -736,25 +480,9 @@ case 4: $this->setOrden($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ProvinciaPeer::getFieldNames($keyType); @@ -766,11 +494,7 @@ if (array_key_exists($keys[4], $arr)) $this->setOrden($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ProvinciaPeer::DATABASE_NAME); @@ -784,14 +508,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ProvinciaPeer::DATABASE_NAME); @@ -801,36 +518,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Provincia (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -844,9 +544,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getLocacions() as $relObj) { $copyObj->addLocacion($relObj->copy($deepCopy)); @@ -872,45 +570,23 @@ $copyObj->addDocente($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Provincia Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ProvinciaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -919,13 +595,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Pais object. - * - * @param Pais $v - * @return void - * @throws PropelException - */ + public function setPais($v) { @@ -941,41 +611,21 @@ } - /** - * Get the associated Pais object - * - * @param Connection Optional Connection object. - * @return Pais The associated Pais object. - * @throws PropelException - */ + public function getPais($con = null) { - // include the related Peer class - include_once 'model/om/BasePaisPeer.php'; + include_once 'lib/model/om/BasePaisPeer.php'; if ($this->aPais === null && ($this->fk_pais_id !== null)) { $this->aPais = PaisPeer::retrieveByPK($this->fk_pais_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PaisPeer::retrieveByPK($this->fk_pais_id, $con); - $obj->addPaiss($this); - */ + } return $this->aPais; } - /** - * Temporary storage of collLocacions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLocacions() { if ($this->collLocacions === null) { @@ -983,23 +633,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia has previously - * been saved, it will retrieve related Locacions from storage. - * If this Provincia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLocacions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1019,13 +656,9 @@ $this->collLocacions = LocacionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LocacionPeer::FK_PROVINCIA_ID, $this->getId()); LocacionPeer::addSelectColumns($criteria); @@ -1038,18 +671,10 @@ return $this->collLocacions; } - /** - * Returns the number of related Locacions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLocacions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1063,14 +688,7 @@ return LocacionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Locacion object to this object - * through the Locacion foreign key attribute - * - * @param Locacion $l Locacion - * @return void - * @throws PropelException - */ + public function addLocacion(Locacion $l) { $this->collLocacions[] = $l; @@ -1078,21 +696,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Locacions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getLocacionsJoinTipolocacion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1111,10 +718,7 @@ $this->collLocacions = LocacionPeer::doSelectJoinTipolocacion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LocacionPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastLocacionCriteria) || !$this->lastLocacionCriteria->equals($criteria)) { @@ -1126,12 +730,7 @@ return $this->collLocacions; } - /** - * Temporary storage of collOrganizacions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initOrganizacions() { if ($this->collOrganizacions === null) { @@ -1139,23 +738,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia has previously - * been saved, it will retrieve related Organizacions from storage. - * If this Provincia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getOrganizacions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1175,13 +761,9 @@ $this->collOrganizacions = OrganizacionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(OrganizacionPeer::FK_PROVINCIA_ID, $this->getId()); OrganizacionPeer::addSelectColumns($criteria); @@ -1194,18 +776,10 @@ return $this->collOrganizacions; } - /** - * Returns the number of related Organizacions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countOrganizacions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1219,14 +793,7 @@ return OrganizacionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Organizacion object to this object - * through the Organizacion foreign key attribute - * - * @param Organizacion $l Organizacion - * @return void - * @throws PropelException - */ + public function addOrganizacion(Organizacion $l) { $this->collOrganizacions[] = $l; @@ -1234,21 +801,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Organizacions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getOrganizacionsJoinTipoiva($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1267,10 +823,7 @@ $this->collOrganizacions = OrganizacionPeer::doSelectJoinTipoiva($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(OrganizacionPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastOrganizacionCriteria) || !$this->lastOrganizacionCriteria->equals($criteria)) { @@ -1282,12 +835,7 @@ return $this->collOrganizacions; } - /** - * Temporary storage of collCuentas to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initCuentas() { if ($this->collCuentas === null) { @@ -1295,23 +843,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia has previously - * been saved, it will retrieve related Cuentas from storage. - * If this Provincia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getCuentas($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1331,13 +866,9 @@ $this->collCuentas = CuentaPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(CuentaPeer::FK_PROVINCIA_ID, $this->getId()); CuentaPeer::addSelectColumns($criteria); @@ -1350,18 +881,10 @@ return $this->collCuentas; } - /** - * Returns the number of related Cuentas. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countCuentas($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1375,14 +898,7 @@ return CuentaPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Cuenta object to this object - * through the Cuenta foreign key attribute - * - * @param Cuenta $l Cuenta - * @return void - * @throws PropelException - */ + public function addCuenta(Cuenta $l) { $this->collCuentas[] = $l; @@ -1390,21 +906,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Cuentas from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getCuentasJoinTipoiva($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1423,10 +928,7 @@ $this->collCuentas = CuentaPeer::doSelectJoinTipoiva($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(CuentaPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastCuentaCriteria) || !$this->lastCuentaCriteria->equals($criteria)) { @@ -1438,12 +940,7 @@ return $this->collCuentas; } - /** - * Temporary storage of collAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAlumnos() { if ($this->collAlumnos === null) { @@ -1451,23 +948,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia has previously - * been saved, it will retrieve related Alumnos from storage. - * If this Provincia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1487,13 +971,9 @@ $this->collAlumnos = AlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AlumnoPeer::FK_PROVINCIA_ID, $this->getId()); AlumnoPeer::addSelectColumns($criteria); @@ -1506,18 +986,10 @@ return $this->collAlumnos; } - /** - * Returns the number of related Alumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1531,14 +1003,7 @@ return AlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Alumno object to this object - * through the Alumno foreign key attribute - * - * @param Alumno $l Alumno - * @return void - * @throws PropelException - */ + public function addAlumno(Alumno $l) { $this->collAlumnos[] = $l; @@ -1546,21 +1011,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getAlumnosJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1579,10 +1033,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1595,21 +1046,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getAlumnosJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1628,10 +1068,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1644,21 +1081,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getAlumnosJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1677,10 +1103,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1693,21 +1116,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getAlumnosJoinConceptobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1726,10 +1138,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinConceptobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1742,21 +1151,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getAlumnosJoinPais($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1775,10 +1173,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinPais($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1790,12 +1185,7 @@ return $this->collAlumnos; } - /** - * Temporary storage of collResponsables to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initResponsables() { if ($this->collResponsables === null) { @@ -1803,23 +1193,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia has previously - * been saved, it will retrieve related Responsables from storage. - * If this Provincia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getResponsables($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1839,13 +1216,9 @@ $this->collResponsables = ResponsablePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ResponsablePeer::FK_PROVINCIA_ID, $this->getId()); ResponsablePeer::addSelectColumns($criteria); @@ -1858,18 +1231,10 @@ return $this->collResponsables; } - /** - * Returns the number of related Responsables. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countResponsables($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1883,14 +1248,7 @@ return ResponsablePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Responsable object to this object - * through the Responsable foreign key attribute - * - * @param Responsable $l Responsable - * @return void - * @throws PropelException - */ + public function addResponsable(Responsable $l) { $this->collResponsables[] = $l; @@ -1898,21 +1256,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Responsables from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getResponsablesJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1931,10 +1278,7 @@ $this->collResponsables = ResponsablePeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ResponsablePeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastResponsableCriteria) || !$this->lastResponsableCriteria->equals($criteria)) { @@ -1947,21 +1291,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Responsables from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getResponsablesJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1980,10 +1313,7 @@ $this->collResponsables = ResponsablePeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ResponsablePeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastResponsableCriteria) || !$this->lastResponsableCriteria->equals($criteria)) { @@ -1995,12 +1325,7 @@ return $this->collResponsables; } - /** - * Temporary storage of collDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initDocentes() { if ($this->collDocentes === null) { @@ -2008,23 +1333,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia has previously - * been saved, it will retrieve related Docentes from storage. - * If this Provincia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2044,13 +1356,9 @@ $this->collDocentes = DocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(DocentePeer::FK_PROVINCIA_ID, $this->getId()); DocentePeer::addSelectColumns($criteria); @@ -2063,18 +1371,10 @@ return $this->collDocentes; } - /** - * Returns the number of related Docentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2088,14 +1388,7 @@ return DocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Docente object to this object - * through the Docente foreign key attribute - * - * @param Docente $l Docente - * @return void - * @throws PropelException - */ + public function addDocente(Docente $l) { $this->collDocentes[] = $l; @@ -2103,21 +1396,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Provincia is new, it will return - * an empty collection; or if this Provincia has previously - * been saved, it will retrieve related Docentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Provincia. - */ + public function getDocentesJoinTipodocumento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -2136,10 +1418,7 @@ $this->collDocentes = DocentePeer::doSelectJoinTipodocumento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(DocentePeer::FK_PROVINCIA_ID, $this->getId()); if (!isset($this->lastDocenteCriteria) || !$this->lastDocenteCriteria->equals($criteria)) { @@ -2151,4 +1430,4 @@ return $this->collDocentes; } -} // BaseProvincia +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseProvinciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseProvinciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseProvinciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ProvinciaPeer::getOMClass() -include_once 'model/Provincia.php'; -/** - * Base static class for performing query and update operations on the 'provincia' table. - * - * - * - * @package model.om - */ abstract class BaseProvinciaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'provincia'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Provincia'; + + const CLASS_DEFAULT = 'lib.model.Provincia'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'provincia.ID'; - /** the column name for the NOMBRE_CORTO field */ + const NOMBRE_CORTO = 'provincia.NOMBRE_CORTO'; - /** the column name for the NOMBRE_LARGO field */ + const NOMBRE_LARGO = 'provincia.NOMBRE_LARGO'; - /** the column name for the FK_PAIS_ID field */ + const FK_PAIS_ID = 'provincia.FK_PAIS_ID'; - /** the column name for the ORDEN field */ + const ORDEN = 'provincia.ORDEN'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'NombreCorto', 'NombreLargo', 'FkPaisId', 'Orden', ), BasePeer::TYPE_COLNAME => array (ProvinciaPeer::ID, ProvinciaPeer::NOMBRE_CORTO, ProvinciaPeer::NOMBRE_LARGO, ProvinciaPeer::FK_PAIS_ID, ProvinciaPeer::ORDEN, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'NombreCorto' => 1, 'NombreLargo' => 2, 'FkPaisId' => 3, 'Orden' => 4, ), BasePeer::TYPE_COLNAME => array (ProvinciaPeer::ID => 0, ProvinciaPeer::NOMBRE_CORTO => 1, ProvinciaPeer::NOMBRE_LARGO => 2, ProvinciaPeer::FK_PAIS_ID => 3, ProvinciaPeer::ORDEN => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ProvinciaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ProvinciaMapBuilder'); + include_once 'lib/model/map/ProvinciaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ProvinciaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ProvinciaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ProvinciaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(provincia.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT provincia.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ProvinciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ProvinciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Provincia - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ProvinciaPeer::populateObjects(ProvinciaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ ProvinciaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ProvinciaPeer::getOMClass(); + $cls = ProvinciaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -312,29 +193,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Pais table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPais(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ProvinciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ProvinciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -345,25 +216,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Provincia objects pre-filled with their Pais objects. - * - * @return array Array of Provincia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPais(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -391,46 +254,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPais(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPais(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addProvincia($obj1); //CHECKME - break; + $temp_obj2->addProvincia($obj1); break; } } if ($newObject) { $obj2->initProvincias(); - $obj2->addProvincia($obj1); //CHECKME - } + $obj2->addProvincia($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ProvinciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ProvinciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -441,25 +291,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Provincia objects pre-filled with all related objects. - * - * @return array Array of Provincia objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -484,8 +326,7 @@ $obj1->hydrate($rs); - // Add objects for joined Pais rows - + $omClass = PaisPeer::getOMClass(); @@ -496,11 +337,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getPais(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPais(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addProvincia($obj1); // CHECKME - break; + $temp_obj2->addProvincia($obj1); break; } } @@ -514,41 +353,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ProvinciaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Provincia or Criteria object. - * - * @param mixed $values Criteria or Provincia object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -556,21 +373,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Provincia object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ProvinciaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ProvinciaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -581,15 +392,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Provincia or Criteria object. - * - * @param mixed $values Criteria or Provincia object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -599,37 +402,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ProvinciaPeer::ID); $selectCriteria->add(ProvinciaPeer::ID, $criteria->remove(ProvinciaPeer::ID), $comparison); - } else { // $values is Provincia object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the provincia table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ProvinciaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -639,17 +430,7 @@ } } - /** - * Method perform a DELETE on the database, given a Provincia or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Provincia object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -657,25 +438,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Provincia) { + $criteria = clone $values; } elseif ($values instanceof Provincia) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ProvinciaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -686,18 +461,7 @@ } } - /** - * Validates all modified columns of given Provincia object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Provincia $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Provincia $obj, $cols = null) { $columns = array(); @@ -732,13 +496,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Provincia - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -755,14 +513,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -780,20 +531,14 @@ return $objs; } -} // BaseProvinciaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseProvinciaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ProvinciaMapBuilder.php'; - Propel::registerMapBuilder('model.map.ProvinciaMapBuilder'); + require_once 'lib/model/map/ProvinciaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ProvinciaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,116 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelActividadDocentePeer.php'; - -/** - * Base class that represents a row from the 'rel_actividad_docente' table. - * - * - * - * @package model.om - */ abstract class BaseRelActividadDocente extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelActividadDocentePeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_actividad_id field. - * @var int - */ + protected $fk_actividad_id = 0; - /** - * The value for the fk_docente_id field. - * @var int - */ + protected $fk_docente_id = 0; - /** - * @var Docente - */ + protected $aDocente; - /** - * @var Actividad - */ + protected $aActividad; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_actividad_id] column value. - * - * @return int - */ + public function getFkActividadId() { return $this->fk_actividad_id; } - /** - * Get the [fk_docente_id] column value. - * - * @return int - */ + public function getFkDocenteId() { return $this->fk_docente_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -119,14 +61,8 @@ $this->modifiedColumns[] = RelActividadDocentePeer::ID; } - } // setId() - - /** - * Set the value of [fk_actividad_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkActividadId($v) { @@ -139,14 +75,8 @@ $this->aActividad = null; } - } // setFkActividadId() - - /** - * Set the value of [fk_docente_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDocenteId($v) { @@ -159,21 +89,8 @@ $this->aDocente = null; } - } // setFkDocenteId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -188,23 +105,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RelActividadDocentePeer::NUM_COLUMNS - RelActividadDocentePeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating RelActividadDocente object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -226,16 +133,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -257,29 +155,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aDocente !== null) { if ($this->aDocente->isModified()) { $affectedRows += $this->aDocente->save($con); @@ -295,57 +178,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelActividadDocentePeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelActividadDocentePeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -358,16 +215,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -377,11 +225,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aDocente !== null) { if (!$this->aDocente->validate($columns)) { $failureMap = array_merge($failureMap, $this->aDocente->getValidationFailures()); @@ -407,28 +251,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelActividadDocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -444,19 +274,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelActividadDocentePeer::getFieldNames($keyType); @@ -468,30 +288,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelActividadDocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -504,25 +308,9 @@ case 2: $this->setFkDocenteId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelActividadDocentePeer::getFieldNames($keyType); @@ -532,11 +320,7 @@ if (array_key_exists($keys[2], $arr)) $this->setFkDocenteId($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelActividadDocentePeer::DATABASE_NAME); @@ -548,14 +332,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelActividadDocentePeer::DATABASE_NAME); @@ -565,36 +342,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelActividadDocente (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -605,40 +365,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelActividadDocente Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelActividadDocentePeer - */ + public function getPeer() { if (self::$peer === null) { @@ -647,13 +386,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Docente object. - * - * @param Docente $v - * @return void - * @throws PropelException - */ + public function setDocente($v) { @@ -669,42 +402,21 @@ } - /** - * Get the associated Docente object - * - * @param Connection Optional Connection object. - * @return Docente The associated Docente object. - * @throws PropelException - */ + public function getDocente($con = null) { - // include the related Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($this->aDocente === null && ($this->fk_docente_id !== null)) { $this->aDocente = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - $obj->addDocentes($this); - */ + } return $this->aDocente; } - /** - * Declares an association between this object and a Actividad object. - * - * @param Actividad $v - * @return void - * @throws PropelException - */ + public function setActividad($v) { @@ -720,33 +432,18 @@ } - /** - * Get the associated Actividad object - * - * @param Connection Optional Connection object. - * @return Actividad The associated Actividad object. - * @throws PropelException - */ + public function getActividad($con = null) { - // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { $this->aActividad = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - $obj->addActividads($this); - */ + } return $this->aActividad; } -} // BaseRelActividadDocente +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelActividadDocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelActividadDocentePeer::getOMClass() -include_once 'model/RelActividadDocente.php'; -/** - * Base static class for performing query and update operations on the 'rel_actividad_docente' table. - * - * - * - * @package model.om - */ abstract class BaseRelActividadDocentePeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_actividad_docente'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelActividadDocente'; + + const CLASS_DEFAULT = 'lib.model.RelActividadDocente'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_actividad_docente.ID'; - /** the column name for the FK_ACTIVIDAD_ID field */ + const FK_ACTIVIDAD_ID = 'rel_actividad_docente.FK_ACTIVIDAD_ID'; - /** the column name for the FK_DOCENTE_ID field */ + const FK_DOCENTE_ID = 'rel_actividad_docente.FK_DOCENTE_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkActividadId', 'FkDocenteId', ), BasePeer::TYPE_COLNAME => array (RelActividadDocentePeer::ID, RelActividadDocentePeer::FK_ACTIVIDAD_ID, RelActividadDocentePeer::FK_DOCENTE_ID, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkActividadId' => 1, 'FkDocenteId' => 2, ), BasePeer::TYPE_COLNAME => array (RelActividadDocentePeer::ID => 0, RelActividadDocentePeer::FK_ACTIVIDAD_ID => 1, RelActividadDocentePeer::FK_DOCENTE_ID => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelActividadDocenteMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelActividadDocenteMapBuilder'); + include_once 'lib/model/map/RelActividadDocenteMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelActividadDocenteMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelActividadDocentePeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelActividadDocentePeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(rel_actividad_docente.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_actividad_docente.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelActividadDocente - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelActividadDocentePeer::populateObjects(RelActividadDocentePeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RelActividadDocentePeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelActividadDocentePeer::getOMClass(); + $cls = RelActividadDocentePeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -302,29 +183,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -335,35 +206,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -374,25 +234,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelActividadDocente objects pre-filled with their Docente objects. - * - * @return array Array of RelActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -420,37 +272,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelActividadDocentes(); - $obj2->addRelActividadDocente($obj1); //CHECKME - } + $obj2->addRelActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelActividadDocente objects pre-filled with their Actividad objects. - * - * @return array Array of RelActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -478,46 +319,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelActividadDocentes(); - $obj2->addRelActividadDocente($obj1); //CHECKME - } + $obj2->addRelActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -530,25 +358,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelActividadDocente objects pre-filled with all related objects. - * - * @return array Array of RelActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -578,8 +398,7 @@ $obj1->hydrate($rs); - // Add objects for joined Docente rows - + $omClass = DocentePeer::getOMClass(); @@ -590,11 +409,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDocente(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelActividadDocente($obj1); // CHECKME - break; + $temp_obj2->addRelActividadDocente($obj1); break; } } @@ -604,8 +421,7 @@ } - // Add objects for joined Actividad rows - + $omClass = ActividadPeer::getOMClass(); @@ -616,11 +432,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getActividad(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getActividad(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelActividadDocente($obj1); // CHECKME - break; + $temp_obj3->addRelActividadDocente($obj1); break; } } @@ -635,29 +449,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -668,35 +472,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -707,27 +500,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelActividadDocente objects pre-filled with all related objects except Docente. - * - * @return array Array of RelActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -761,8 +544,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelActividadDocente($obj1); break; @@ -780,21 +562,12 @@ } - /** - * Selects a collection of RelActividadDocente objects pre-filled with all related objects except Actividad. - * - * @return array Array of RelActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -828,8 +601,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelActividadDocente($obj1); break; @@ -846,41 +618,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelActividadDocentePeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelActividadDocente or Criteria object. - * - * @param mixed $values Criteria or RelActividadDocente object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -888,21 +638,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelActividadDocente object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelActividadDocentePeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelActividadDocentePeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -913,15 +657,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelActividadDocente or Criteria object. - * - * @param mixed $values Criteria or RelActividadDocente object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -931,37 +667,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelActividadDocentePeer::ID); $selectCriteria->add(RelActividadDocentePeer::ID, $criteria->remove(RelActividadDocentePeer::ID), $comparison); - } else { // $values is RelActividadDocente object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_actividad_docente table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelActividadDocentePeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -971,17 +695,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelActividadDocente or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelActividadDocente object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -989,25 +703,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelActividadDocente) { + $criteria = clone $values; } elseif ($values instanceof RelActividadDocente) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelActividadDocentePeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1018,18 +726,7 @@ } } - /** - * Validates all modified columns of given RelActividadDocente object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelActividadDocente $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelActividadDocente $obj, $cols = null) { $columns = array(); @@ -1064,13 +761,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelActividadDocente - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1087,14 +778,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1112,20 +796,14 @@ return $objs; } -} // BaseRelActividadDocentePeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelActividadDocentePeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelActividadDocenteMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelActividadDocenteMapBuilder'); + require_once 'lib/model/map/RelActividadDocenteMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelActividadDocenteMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivision.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivision.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivision.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,116 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelAlumnoDivisionPeer.php'; - -/** - * Base class that represents a row from the 'rel_alumno_division' table. - * - * - * - * @package model.om - */ abstract class BaseRelAlumnoDivision extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelAlumnoDivisionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_division_id field. - * @var int - */ + protected $fk_division_id = 0; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id = 0; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * @var Division - */ + protected $aDivision; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_division_id] column value. - * - * @return int - */ + public function getFkDivisionId() { return $this->fk_division_id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -119,14 +61,8 @@ $this->modifiedColumns[] = RelAlumnoDivisionPeer::ID; } - } // setId() - - /** - * Set the value of [fk_division_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDivisionId($v) { @@ -139,14 +75,8 @@ $this->aDivision = null; } - } // setFkDivisionId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -159,21 +89,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -188,23 +105,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RelAlumnoDivisionPeer::NUM_COLUMNS - RelAlumnoDivisionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating RelAlumnoDivision object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -226,16 +133,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -257,29 +155,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAlumno !== null) { if ($this->aAlumno->isModified()) { $affectedRows += $this->aAlumno->save($con); @@ -295,57 +178,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelAlumnoDivisionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelAlumnoDivisionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -358,16 +215,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -377,11 +225,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aAlumno !== null) { if (!$this->aAlumno->validate($columns)) { $failureMap = array_merge($failureMap, $this->aAlumno->getValidationFailures()); @@ -407,28 +251,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelAlumnoDivisionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -444,19 +274,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelAlumnoDivisionPeer::getFieldNames($keyType); @@ -468,30 +288,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelAlumnoDivisionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -504,25 +308,9 @@ case 2: $this->setFkAlumnoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelAlumnoDivisionPeer::getFieldNames($keyType); @@ -532,11 +320,7 @@ if (array_key_exists($keys[2], $arr)) $this->setFkAlumnoId($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelAlumnoDivisionPeer::DATABASE_NAME); @@ -548,14 +332,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelAlumnoDivisionPeer::DATABASE_NAME); @@ -565,36 +342,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelAlumnoDivision (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -605,40 +365,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelAlumnoDivision Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelAlumnoDivisionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -647,13 +386,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -669,42 +402,21 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } - /** - * Declares an association between this object and a Division object. - * - * @param Division $v - * @return void - * @throws PropelException - */ + public function setDivision($v) { @@ -720,33 +432,18 @@ } - /** - * Get the associated Division object - * - * @param Connection Optional Connection object. - * @return Division The associated Division object. - * @throws PropelException - */ + public function getDivision($con = null) { - // include the related Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($this->aDivision === null && ($this->fk_division_id !== null)) { $this->aDivision = DivisionPeer::retrieveByPK($this->fk_division_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DivisionPeer::retrieveByPK($this->fk_division_id, $con); - $obj->addDivisions($this); - */ + } return $this->aDivision; } -} // BaseRelAlumnoDivision +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivisionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivisionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelAlumnoDivisionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelAlumnoDivisionPeer::getOMClass() -include_once 'model/RelAlumnoDivision.php'; -/** - * Base static class for performing query and update operations on the 'rel_alumno_division' table. - * - * - * - * @package model.om - */ abstract class BaseRelAlumnoDivisionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_alumno_division'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelAlumnoDivision'; + + const CLASS_DEFAULT = 'lib.model.RelAlumnoDivision'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_alumno_division.ID'; - /** the column name for the FK_DIVISION_ID field */ + const FK_DIVISION_ID = 'rel_alumno_division.FK_DIVISION_ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'rel_alumno_division.FK_ALUMNO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkDivisionId', 'FkAlumnoId', ), BasePeer::TYPE_COLNAME => array (RelAlumnoDivisionPeer::ID, RelAlumnoDivisionPeer::FK_DIVISION_ID, RelAlumnoDivisionPeer::FK_ALUMNO_ID, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkDivisionId' => 1, 'FkAlumnoId' => 2, ), BasePeer::TYPE_COLNAME => array (RelAlumnoDivisionPeer::ID => 0, RelAlumnoDivisionPeer::FK_DIVISION_ID => 1, RelAlumnoDivisionPeer::FK_ALUMNO_ID => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelAlumnoDivisionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelAlumnoDivisionMapBuilder'); + include_once 'lib/model/map/RelAlumnoDivisionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelAlumnoDivisionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelAlumnoDivisionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelAlumnoDivisionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(rel_alumno_division.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_alumno_division.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelAlumnoDivision - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelAlumnoDivisionPeer::populateObjects(RelAlumnoDivisionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RelAlumnoDivisionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelAlumnoDivisionPeer::getOMClass(); + $cls = RelAlumnoDivisionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -302,29 +183,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -335,35 +206,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Division table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDivision(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -374,25 +234,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelAlumnoDivision objects pre-filled with their Alumno objects. - * - * @return array Array of RelAlumnoDivision objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -420,37 +272,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelAlumnoDivision($obj1); //CHECKME - break; + $temp_obj2->addRelAlumnoDivision($obj1); break; } } if ($newObject) { $obj2->initRelAlumnoDivisions(); - $obj2->addRelAlumnoDivision($obj1); //CHECKME - } + $obj2->addRelAlumnoDivision($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelAlumnoDivision objects pre-filled with their Division objects. - * - * @return array Array of RelAlumnoDivision objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDivision(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -478,46 +319,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelAlumnoDivision($obj1); //CHECKME - break; + $temp_obj2->addRelAlumnoDivision($obj1); break; } } if ($newObject) { $obj2->initRelAlumnoDivisions(); - $obj2->addRelAlumnoDivision($obj1); //CHECKME - } + $obj2->addRelAlumnoDivision($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -530,25 +358,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelAlumnoDivision objects pre-filled with all related objects. - * - * @return array Array of RelAlumnoDivision objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -578,8 +398,7 @@ $obj1->hydrate($rs); - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -590,11 +409,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelAlumnoDivision($obj1); // CHECKME - break; + $temp_obj2->addRelAlumnoDivision($obj1); break; } } @@ -604,8 +421,7 @@ } - // Add objects for joined Division rows - + $omClass = DivisionPeer::getOMClass(); @@ -616,11 +432,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getDivision(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getDivision(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelAlumnoDivision($obj1); // CHECKME - break; + $temp_obj3->addRelAlumnoDivision($obj1); break; } } @@ -635,29 +449,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -668,35 +472,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Division table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDivision(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAlumnoDivisionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -707,27 +500,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelAlumnoDivision objects pre-filled with all related objects except Alumno. - * - * @return array Array of RelAlumnoDivision objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -761,8 +544,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelAlumnoDivision($obj1); break; @@ -780,21 +562,12 @@ } - /** - * Selects a collection of RelAlumnoDivision objects pre-filled with all related objects except Division. - * - * @return array Array of RelAlumnoDivision objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDivision(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -828,8 +601,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelAlumnoDivision($obj1); break; @@ -846,41 +618,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelAlumnoDivisionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelAlumnoDivision or Criteria object. - * - * @param mixed $values Criteria or RelAlumnoDivision object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -888,21 +638,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelAlumnoDivision object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelAlumnoDivisionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelAlumnoDivisionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -913,15 +657,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelAlumnoDivision or Criteria object. - * - * @param mixed $values Criteria or RelAlumnoDivision object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -931,37 +667,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelAlumnoDivisionPeer::ID); $selectCriteria->add(RelAlumnoDivisionPeer::ID, $criteria->remove(RelAlumnoDivisionPeer::ID), $comparison); - } else { // $values is RelAlumnoDivision object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_alumno_division table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelAlumnoDivisionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -971,17 +695,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelAlumnoDivision or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelAlumnoDivision object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -989,25 +703,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelAlumnoDivision) { + $criteria = clone $values; } elseif ($values instanceof RelAlumnoDivision) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelAlumnoDivisionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1018,18 +726,7 @@ } } - /** - * Validates all modified columns of given RelAlumnoDivision object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelAlumnoDivision $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelAlumnoDivision $obj, $cols = null) { $columns = array(); @@ -1064,13 +761,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelAlumnoDivision - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1087,14 +778,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1112,20 +796,14 @@ return $objs; } -} // BaseRelAlumnoDivisionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelAlumnoDivisionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelAlumnoDivisionMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelAlumnoDivisionMapBuilder'); + require_once 'lib/model/map/RelAlumnoDivisionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelAlumnoDivisionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,134 +1,69 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelAnioActividadPeer.php'; - -/** - * Base class that represents a row from the 'rel_anio_actividad' table. - * - * - * - * @package model.om - */ abstract class BaseRelAnioActividad extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelAnioActividadPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_anio_id field. - * @var int - */ + protected $fk_anio_id = 0; - /** - * The value for the fk_actividad_id field. - * @var int - */ + protected $fk_actividad_id = 0; - /** - * The value for the horas field. - * @var double - */ + protected $horas = 0; - /** - * @var Actividad - */ + protected $aActividad; - /** - * @var Anio - */ + protected $aAnio; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_anio_id] column value. - * - * @return int - */ + public function getFkAnioId() { return $this->fk_anio_id; } - /** - * Get the [fk_actividad_id] column value. - * - * @return int - */ + public function getFkActividadId() { return $this->fk_actividad_id; } - /** - * Get the [horas] column value. - * - * @return double - */ + public function getHoras() { return $this->horas; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -137,14 +72,8 @@ $this->modifiedColumns[] = RelAnioActividadPeer::ID; } - } // setId() - - /** - * Set the value of [fk_anio_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAnioId($v) { @@ -157,14 +86,8 @@ $this->aAnio = null; } - } // setFkAnioId() - - /** - * Set the value of [fk_actividad_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkActividadId($v) { @@ -177,14 +100,8 @@ $this->aActividad = null; } - } // setFkActividadId() - - /** - * Set the value of [horas] column. - * - * @param double $v new value - * @return void - */ + } + public function setHoras($v) { @@ -193,21 +110,8 @@ $this->modifiedColumns[] = RelAnioActividadPeer::HORAS; } - } // setHoras() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -224,23 +128,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = RelAnioActividadPeer::NUM_COLUMNS - RelAnioActividadPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating RelAnioActividad object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -262,16 +156,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -293,29 +178,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aActividad !== null) { if ($this->aActividad->isModified()) { $affectedRows += $this->aActividad->save($con); @@ -331,57 +201,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelAnioActividadPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelAnioActividadPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -394,16 +238,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -413,11 +248,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aActividad !== null) { if (!$this->aActividad->validate($columns)) { $failureMap = array_merge($failureMap, $this->aActividad->getValidationFailures()); @@ -443,28 +274,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelAnioActividadPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -483,19 +300,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelAnioActividadPeer::getFieldNames($keyType); @@ -508,30 +315,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelAnioActividadPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -547,25 +338,9 @@ case 3: $this->setHoras($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelAnioActividadPeer::getFieldNames($keyType); @@ -576,11 +351,7 @@ if (array_key_exists($keys[3], $arr)) $this->setHoras($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelAnioActividadPeer::DATABASE_NAME); @@ -593,14 +364,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelAnioActividadPeer::DATABASE_NAME); @@ -610,36 +374,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelAnioActividad (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -652,40 +399,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelAnioActividad Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelAnioActividadPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -694,13 +420,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Actividad object. - * - * @param Actividad $v - * @return void - * @throws PropelException - */ + public function setActividad($v) { @@ -716,42 +436,21 @@ } - /** - * Get the associated Actividad object - * - * @param Connection Optional Connection object. - * @return Actividad The associated Actividad object. - * @throws PropelException - */ + public function getActividad($con = null) { - // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { $this->aActividad = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - $obj->addActividads($this); - */ + } return $this->aActividad; } - /** - * Declares an association between this object and a Anio object. - * - * @param Anio $v - * @return void - * @throws PropelException - */ + public function setAnio($v) { @@ -767,33 +466,18 @@ } - /** - * Get the associated Anio object - * - * @param Connection Optional Connection object. - * @return Anio The associated Anio object. - * @throws PropelException - */ + public function getAnio($con = null) { - // include the related Peer class - include_once 'model/om/BaseAnioPeer.php'; + include_once 'lib/model/om/BaseAnioPeer.php'; if ($this->aAnio === null && ($this->fk_anio_id !== null)) { $this->aAnio = AnioPeer::retrieveByPK($this->fk_anio_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AnioPeer::retrieveByPK($this->fk_anio_id, $con); - $obj->addAnios($this); - */ + } return $this->aAnio; } -} // BaseRelAnioActividad +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelAnioActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelAnioActividadPeer::getOMClass() -include_once 'model/RelAnioActividad.php'; -/** - * Base static class for performing query and update operations on the 'rel_anio_actividad' table. - * - * - * - * @package model.om - */ abstract class BaseRelAnioActividadPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_anio_actividad'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelAnioActividad'; + + const CLASS_DEFAULT = 'lib.model.RelAnioActividad'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_anio_actividad.ID'; - /** the column name for the FK_ANIO_ID field */ + const FK_ANIO_ID = 'rel_anio_actividad.FK_ANIO_ID'; - /** the column name for the FK_ACTIVIDAD_ID field */ + const FK_ACTIVIDAD_ID = 'rel_anio_actividad.FK_ACTIVIDAD_ID'; - /** the column name for the HORAS field */ + const HORAS = 'rel_anio_actividad.HORAS'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkAnioId', 'FkActividadId', 'Horas', ), BasePeer::TYPE_COLNAME => array (RelAnioActividadPeer::ID, RelAnioActividadPeer::FK_ANIO_ID, RelAnioActividadPeer::FK_ACTIVIDAD_ID, RelAnioActividadPeer::HORAS, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkAnioId' => 1, 'FkActividadId' => 2, 'Horas' => 3, ), BasePeer::TYPE_COLNAME => array (RelAnioActividadPeer::ID => 0, RelAnioActividadPeer::FK_ANIO_ID => 1, RelAnioActividadPeer::FK_ACTIVIDAD_ID => 2, RelAnioActividadPeer::HORAS => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelAnioActividadMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelAnioActividadMapBuilder'); + include_once 'lib/model/map/RelAnioActividadMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelAnioActividadMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelAnioActividadPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelAnioActividadPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(rel_anio_actividad.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_anio_actividad.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelAnioActividad - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelAnioActividadPeer::populateObjects(RelAnioActividadPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ RelAnioActividadPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelAnioActividadPeer::getOMClass(); + $cls = RelAnioActividadPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -307,29 +188,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -340,35 +211,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Anio table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAnio(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -379,25 +239,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelAnioActividad objects pre-filled with their Actividad objects. - * - * @return array Array of RelAnioActividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -425,37 +277,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelAnioActividad($obj1); //CHECKME - break; + $temp_obj2->addRelAnioActividad($obj1); break; } } if ($newObject) { $obj2->initRelAnioActividads(); - $obj2->addRelAnioActividad($obj1); //CHECKME - } + $obj2->addRelAnioActividad($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelAnioActividad objects pre-filled with their Anio objects. - * - * @return array Array of RelAnioActividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAnio(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -483,46 +324,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAnio(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAnio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelAnioActividad($obj1); //CHECKME - break; + $temp_obj2->addRelAnioActividad($obj1); break; } } if ($newObject) { $obj2->initRelAnioActividads(); - $obj2->addRelAnioActividad($obj1); //CHECKME - } + $obj2->addRelAnioActividad($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -535,25 +363,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelAnioActividad objects pre-filled with all related objects. - * - * @return array Array of RelAnioActividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -583,8 +403,7 @@ $obj1->hydrate($rs); - // Add objects for joined Actividad rows - + $omClass = ActividadPeer::getOMClass(); @@ -595,11 +414,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getActividad(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelAnioActividad($obj1); // CHECKME - break; + $temp_obj2->addRelAnioActividad($obj1); break; } } @@ -609,8 +426,7 @@ } - // Add objects for joined Anio rows - + $omClass = AnioPeer::getOMClass(); @@ -621,11 +437,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAnio(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAnio(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelAnioActividad($obj1); // CHECKME - break; + $temp_obj3->addRelAnioActividad($obj1); break; } } @@ -640,29 +454,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -673,35 +477,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Anio table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAnio(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelAnioActividadPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -712,27 +505,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelAnioActividad objects pre-filled with all related objects except Actividad. - * - * @return array Array of RelAnioActividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -766,8 +549,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAnio(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAnio(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelAnioActividad($obj1); break; @@ -785,21 +567,12 @@ } - /** - * Selects a collection of RelAnioActividad objects pre-filled with all related objects except Anio. - * - * @return array Array of RelAnioActividad objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAnio(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -833,8 +606,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelAnioActividad($obj1); break; @@ -851,41 +623,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelAnioActividadPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelAnioActividad or Criteria object. - * - * @param mixed $values Criteria or RelAnioActividad object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -893,21 +643,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelAnioActividad object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelAnioActividadPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelAnioActividadPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -918,15 +662,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelAnioActividad or Criteria object. - * - * @param mixed $values Criteria or RelAnioActividad object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -936,37 +672,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelAnioActividadPeer::ID); $selectCriteria->add(RelAnioActividadPeer::ID, $criteria->remove(RelAnioActividadPeer::ID), $comparison); - } else { // $values is RelAnioActividad object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_anio_actividad table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelAnioActividadPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -976,17 +700,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelAnioActividad or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelAnioActividad object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -994,25 +708,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelAnioActividad) { + $criteria = clone $values; } elseif ($values instanceof RelAnioActividad) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelAnioActividadPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1023,18 +731,7 @@ } } - /** - * Validates all modified columns of given RelAnioActividad object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelAnioActividad $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelAnioActividad $obj, $cols = null) { $columns = array(); @@ -1069,13 +766,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelAnioActividad - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1092,14 +783,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1117,20 +801,14 @@ return $objs; } -} // BaseRelAnioActividadPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelAnioActividadPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelAnioActividadMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelAnioActividadMapBuilder'); + require_once 'lib/model/map/RelAnioActividadMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelAnioActividadMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumno.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumno.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumno.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,171 +1,92 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelCalendariovacunacionAlumnoPeer.php'; - -/** - * Base class that represents a row from the 'rel_calendariovacunacion_alumno' table. - * - * - * - * @package model.om - */ abstract class BaseRelCalendariovacunacionAlumno extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelCalendariovacunacionAlumnoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_alumno_id field. - * @var int - */ + protected $fk_alumno_id; - /** - * The value for the fk_calendariovacunacion_id field. - * @var int - */ + protected $fk_calendariovacunacion_id; - /** - * The value for the observacion field. - * @var string - */ + protected $observacion; - /** - * The value for the comprobante field. - * @var boolean - */ + protected $comprobante = true; - /** - * The value for the fecha field. - * @var int - */ + protected $fecha; - /** - * @var Calendariovacunacion - */ + protected $aCalendariovacunacion; - /** - * @var Alumno - */ + protected $aAlumno; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_alumno_id] column value. - * - * @return int - */ + public function getFkAlumnoId() { return $this->fk_alumno_id; } - /** - * Get the [fk_calendariovacunacion_id] column value. - * - * @return int - */ + public function getFkCalendariovacunacionId() { return $this->fk_calendariovacunacion_id; } - /** - * Get the [observacion] column value. - * - * @return string - */ + public function getObservacion() { return $this->observacion; } - /** - * Get the [comprobante] column value. - * - * @return boolean - */ + public function getComprobante() { return $this->comprobante; } - /** - * Get the [optionally formatted] [fecha] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFecha($format = 'Y-m-d H:i:s') { if ($this->fecha === null || $this->fecha === '') { return null; } elseif (!is_int($this->fecha)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); + $ts = strtotime($this->fecha); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha] as date/time value: " . var_export($this->fecha, true)); } } else { $ts = $this->fecha; @@ -179,12 +100,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -193,14 +109,8 @@ $this->modifiedColumns[] = RelCalendariovacunacionAlumnoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_alumno_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkAlumnoId($v) { @@ -213,14 +123,8 @@ $this->aAlumno = null; } - } // setFkAlumnoId() - - /** - * Set the value of [fk_calendariovacunacion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCalendariovacunacionId($v) { @@ -233,14 +137,8 @@ $this->aCalendariovacunacion = null; } - } // setFkCalendariovacunacionId() - - /** - * Set the value of [observacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setObservacion($v) { @@ -249,14 +147,8 @@ $this->modifiedColumns[] = RelCalendariovacunacionAlumnoPeer::OBSERVACION; } - } // setObservacion() - - /** - * Set the value of [comprobante] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setComprobante($v) { @@ -265,21 +157,14 @@ $this->modifiedColumns[] = RelCalendariovacunacionAlumnoPeer::COMPROBANTE; } - } // setComprobante() - - /** - * Set the value of [fecha] column. - * - * @param int $v new value - * @return void - */ + } + public function setFecha($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -289,21 +174,8 @@ $this->modifiedColumns[] = RelCalendariovacunacionAlumnoPeer::FECHA; } - } // setFecha() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -324,23 +196,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = RelCalendariovacunacionAlumnoPeer::NUM_COLUMNS - RelCalendariovacunacionAlumnoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating RelCalendariovacunacionAlumno object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -362,16 +224,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -393,29 +246,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCalendariovacunacion !== null) { if ($this->aCalendariovacunacion->isModified()) { $affectedRows += $this->aCalendariovacunacion->save($con); @@ -431,57 +269,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelCalendariovacunacionAlumnoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelCalendariovacunacionAlumnoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -494,16 +306,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -513,11 +316,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCalendariovacunacion !== null) { if (!$this->aCalendariovacunacion->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCalendariovacunacion->getValidationFailures()); @@ -543,28 +342,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelCalendariovacunacionAlumnoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -589,19 +374,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelCalendariovacunacionAlumnoPeer::getFieldNames($keyType); @@ -616,30 +391,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelCalendariovacunacionAlumnoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -661,25 +420,9 @@ case 5: $this->setFecha($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelCalendariovacunacionAlumnoPeer::getFieldNames($keyType); @@ -692,11 +435,7 @@ if (array_key_exists($keys[5], $arr)) $this->setFecha($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelCalendariovacunacionAlumnoPeer::DATABASE_NAME); @@ -711,14 +450,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelCalendariovacunacionAlumnoPeer::DATABASE_NAME); @@ -728,36 +460,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelCalendariovacunacionAlumno (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -774,40 +489,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelCalendariovacunacionAlumno Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelCalendariovacunacionAlumnoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -816,13 +510,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Calendariovacunacion object. - * - * @param Calendariovacunacion $v - * @return void - * @throws PropelException - */ + public function setCalendariovacunacion($v) { @@ -838,42 +526,21 @@ } - /** - * Get the associated Calendariovacunacion object - * - * @param Connection Optional Connection object. - * @return Calendariovacunacion The associated Calendariovacunacion object. - * @throws PropelException - */ + public function getCalendariovacunacion($con = null) { - // include the related Peer class - include_once 'model/om/BaseCalendariovacunacionPeer.php'; + include_once 'lib/model/om/BaseCalendariovacunacionPeer.php'; if ($this->aCalendariovacunacion === null && ($this->fk_calendariovacunacion_id !== null)) { $this->aCalendariovacunacion = CalendariovacunacionPeer::retrieveByPK($this->fk_calendariovacunacion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CalendariovacunacionPeer::retrieveByPK($this->fk_calendariovacunacion_id, $con); - $obj->addCalendariovacunacions($this); - */ + } return $this->aCalendariovacunacion; } - /** - * Declares an association between this object and a Alumno object. - * - * @param Alumno $v - * @return void - * @throws PropelException - */ + public function setAlumno($v) { @@ -889,33 +556,18 @@ } - /** - * Get the associated Alumno object - * - * @param Connection Optional Connection object. - * @return Alumno The associated Alumno object. - * @throws PropelException - */ + public function getAlumno($con = null) { - // include the related Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($this->aAlumno === null && ($this->fk_alumno_id !== null)) { $this->aAlumno = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = AlumnoPeer::retrieveByPK($this->fk_alumno_id, $con); - $obj->addAlumnos($this); - */ + } return $this->aAlumno; } -} // BaseRelCalendariovacunacionAlumno +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelCalendariovacunacionAlumnoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelCalendariovacunacionAlumnoPeer::getOMClass() -include_once 'model/RelCalendariovacunacionAlumno.php'; -/** - * Base static class for performing query and update operations on the 'rel_calendariovacunacion_alumno' table. - * - * - * - * @package model.om - */ abstract class BaseRelCalendariovacunacionAlumnoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_calendariovacunacion_alumno'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelCalendariovacunacionAlumno'; + + const CLASS_DEFAULT = 'lib.model.RelCalendariovacunacionAlumno'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_calendariovacunacion_alumno.ID'; - /** the column name for the FK_ALUMNO_ID field */ + const FK_ALUMNO_ID = 'rel_calendariovacunacion_alumno.FK_ALUMNO_ID'; - /** the column name for the FK_CALENDARIOVACUNACION_ID field */ + const FK_CALENDARIOVACUNACION_ID = 'rel_calendariovacunacion_alumno.FK_CALENDARIOVACUNACION_ID'; - /** the column name for the OBSERVACION field */ + const OBSERVACION = 'rel_calendariovacunacion_alumno.OBSERVACION'; - /** the column name for the COMPROBANTE field */ + const COMPROBANTE = 'rel_calendariovacunacion_alumno.COMPROBANTE'; - /** the column name for the FECHA field */ + const FECHA = 'rel_calendariovacunacion_alumno.FECHA'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkAlumnoId', 'FkCalendariovacunacionId', 'Observacion', 'Comprobante', 'Fecha', ), BasePeer::TYPE_COLNAME => array (RelCalendariovacunacionAlumnoPeer::ID, RelCalendariovacunacionAlumnoPeer::FK_ALUMNO_ID, RelCalendariovacunacionAlumnoPeer::FK_CALENDARIOVACUNACION_ID, RelCalendariovacunacionAlumnoPeer::OBSERVACION, RelCalendariovacunacionAlumnoPeer::COMPROBANTE, RelCalendariovacunacionAlumnoPeer::FECHA, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkAlumnoId' => 1, 'FkCalendariovacunacionId' => 2, 'Observacion' => 3, 'Comprobante' => 4, 'Fecha' => 5, ), BasePeer::TYPE_COLNAME => array (RelCalendariovacunacionAlumnoPeer::ID => 0, RelCalendariovacunacionAlumnoPeer::FK_ALUMNO_ID => 1, RelCalendariovacunacionAlumnoPeer::FK_CALENDARIOVACUNACION_ID => 2, RelCalendariovacunacionAlumnoPeer::OBSERVACION => 3, RelCalendariovacunacionAlumnoPeer::COMPROBANTE => 4, RelCalendariovacunacionAlumnoPeer::FECHA => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelCalendariovacunacionAlumnoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelCalendariovacunacionAlumnoMapBuilder'); + include_once 'lib/model/map/RelCalendariovacunacionAlumnoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelCalendariovacunacionAlumnoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelCalendariovacunacionAlumnoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelCalendariovacunacionAlumnoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(rel_calendariovacunacion_alumno.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_calendariovacunacion_alumno.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelCalendariovacunacionAlumno - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelCalendariovacunacionAlumnoPeer::populateObjects(RelCalendariovacunacionAlumnoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ RelCalendariovacunacionAlumnoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelCalendariovacunacionAlumnoPeer::getOMClass(); + $cls = RelCalendariovacunacionAlumnoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -317,29 +198,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Calendariovacunacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCalendariovacunacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -350,35 +221,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -389,25 +249,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelCalendariovacunacionAlumno objects pre-filled with their Calendariovacunacion objects. - * - * @return array Array of RelCalendariovacunacionAlumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCalendariovacunacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -435,37 +287,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCalendariovacunacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCalendariovacunacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelCalendariovacunacionAlumno($obj1); //CHECKME - break; + $temp_obj2->addRelCalendariovacunacionAlumno($obj1); break; } } if ($newObject) { $obj2->initRelCalendariovacunacionAlumnos(); - $obj2->addRelCalendariovacunacionAlumno($obj1); //CHECKME - } + $obj2->addRelCalendariovacunacionAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelCalendariovacunacionAlumno objects pre-filled with their Alumno objects. - * - * @return array Array of RelCalendariovacunacionAlumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -493,46 +334,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelCalendariovacunacionAlumno($obj1); //CHECKME - break; + $temp_obj2->addRelCalendariovacunacionAlumno($obj1); break; } } if ($newObject) { $obj2->initRelCalendariovacunacionAlumnos(); - $obj2->addRelCalendariovacunacionAlumno($obj1); //CHECKME - } + $obj2->addRelCalendariovacunacionAlumno($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -545,25 +373,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelCalendariovacunacionAlumno objects pre-filled with all related objects. - * - * @return array Array of RelCalendariovacunacionAlumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -593,8 +413,7 @@ $obj1->hydrate($rs); - // Add objects for joined Calendariovacunacion rows - + $omClass = CalendariovacunacionPeer::getOMClass(); @@ -605,11 +424,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCalendariovacunacion(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCalendariovacunacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelCalendariovacunacionAlumno($obj1); // CHECKME - break; + $temp_obj2->addRelCalendariovacunacionAlumno($obj1); break; } } @@ -619,8 +436,7 @@ } - // Add objects for joined Alumno rows - + $omClass = AlumnoPeer::getOMClass(); @@ -631,11 +447,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getAlumno(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getAlumno(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelCalendariovacunacionAlumno($obj1); // CHECKME - break; + $temp_obj3->addRelCalendariovacunacionAlumno($obj1); break; } } @@ -650,29 +464,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Calendariovacunacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptCalendariovacunacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -683,35 +487,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Alumno table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptAlumno(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelCalendariovacunacionAlumnoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -722,27 +515,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelCalendariovacunacionAlumno objects pre-filled with all related objects except Calendariovacunacion. - * - * @return array Array of RelCalendariovacunacionAlumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptCalendariovacunacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -776,8 +559,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getAlumno(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getAlumno(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelCalendariovacunacionAlumno($obj1); break; @@ -795,21 +577,12 @@ } - /** - * Selects a collection of RelCalendariovacunacionAlumno objects pre-filled with all related objects except Alumno. - * - * @return array Array of RelCalendariovacunacionAlumno objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptAlumno(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -843,8 +616,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCalendariovacunacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCalendariovacunacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelCalendariovacunacionAlumno($obj1); break; @@ -861,41 +633,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelCalendariovacunacionAlumnoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelCalendariovacunacionAlumno or Criteria object. - * - * @param mixed $values Criteria or RelCalendariovacunacionAlumno object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -903,21 +653,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelCalendariovacunacionAlumno object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelCalendariovacunacionAlumnoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelCalendariovacunacionAlumnoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -928,15 +672,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelCalendariovacunacionAlumno or Criteria object. - * - * @param mixed $values Criteria or RelCalendariovacunacionAlumno object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -946,37 +682,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelCalendariovacunacionAlumnoPeer::ID); $selectCriteria->add(RelCalendariovacunacionAlumnoPeer::ID, $criteria->remove(RelCalendariovacunacionAlumnoPeer::ID), $comparison); - } else { // $values is RelCalendariovacunacionAlumno object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_calendariovacunacion_alumno table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelCalendariovacunacionAlumnoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -986,17 +710,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelCalendariovacunacionAlumno or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelCalendariovacunacionAlumno object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1004,25 +718,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelCalendariovacunacionAlumno) { + $criteria = clone $values; } elseif ($values instanceof RelCalendariovacunacionAlumno) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelCalendariovacunacionAlumnoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1033,18 +741,7 @@ } } - /** - * Validates all modified columns of given RelCalendariovacunacionAlumno object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelCalendariovacunacionAlumno $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelCalendariovacunacionAlumno $obj, $cols = null) { $columns = array(); @@ -1079,13 +776,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelCalendariovacunacionAlumno - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1102,14 +793,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1127,20 +811,14 @@ return $objs; } -} // BaseRelCalendariovacunacionAlumnoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelCalendariovacunacionAlumnoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelCalendariovacunacionAlumnoMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelCalendariovacunacionAlumnoMapBuilder'); + require_once 'lib/model/map/RelCalendariovacunacionAlumnoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelCalendariovacunacionAlumnoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -7,7 +7,7 @@ include_once 'propel/util/Criteria.php'; -include_once 'model/RelDivisionActividadPeer.php'; +include_once 'lib/model/RelDivisionActividadPeer.php'; /** * Base class that represents a row from the 'rel_division_actividad' table. @@ -1048,7 +1048,7 @@ public function getDivision($con = null) { // include the related Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($this->aDivision === null && ($this->fk_division_id !== null)) { @@ -1099,7 +1099,7 @@ public function getActividad($con = null) { // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { @@ -1150,7 +1150,7 @@ public function getRepeticion($con = null) { // include the related Peer class - include_once 'model/om/BaseRepeticionPeer.php'; + include_once 'lib/model/om/BaseRepeticionPeer.php'; if ($this->aRepeticion === null && ($this->fk_repeticion_id !== null)) { Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,248 +1,138 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelDivisionActividadDocentePeer.php'; - -/** - * Base class that represents a row from the 'rel_division_actividad_docente' table. - * - * - * - * @package model.om - */ abstract class BaseRelDivisionActividadDocente extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelDivisionActividadDocentePeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_division_id field. - * @var int - */ + protected $fk_division_id = 0; - /** - * The value for the fk_actividad_id field. - * @var int - */ + protected $fk_actividad_id = 0; - /** - * The value for the fk_docente_id field. - * @var int - */ + protected $fk_docente_id = 0; - /** - * The value for the fk_tipodocente_id field. - * @var int - */ + protected $fk_tipodocente_id = 0; - /** - * The value for the fk_cargobaja_id field. - * @var int - */ + protected $fk_cargobaja_id = 0; - /** - * The value for the fk_repeticion_id field. - * @var int - */ + protected $fk_repeticion_id = 0; - /** - * The value for the fecha_inicio field. - * @var int - */ + protected $fecha_inicio; - /** - * The value for the fecha_fin field. - * @var int - */ + protected $fecha_fin; - /** - * The value for the hora_inicio field. - * @var int - */ + protected $hora_inicio; - /** - * The value for the hora_fin field. - * @var int - */ + protected $hora_fin; - /** - * @var Division - */ + protected $aDivision; - /** - * @var Tipodocente - */ + protected $aTipodocente; - /** - * @var Cargobaja - */ + protected $aCargobaja; - /** - * @var Docente - */ + protected $aDocente; - /** - * @var Actividad - */ + protected $aActividad; - /** - * @var Repeticion - */ + protected $aRepeticion; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_division_id] column value. - * - * @return int - */ + public function getFkDivisionId() { return $this->fk_division_id; } - /** - * Get the [fk_actividad_id] column value. - * - * @return int - */ + public function getFkActividadId() { return $this->fk_actividad_id; } - /** - * Get the [fk_docente_id] column value. - * - * @return int - */ + public function getFkDocenteId() { return $this->fk_docente_id; } - /** - * Get the [fk_tipodocente_id] column value. - * - * @return int - */ + public function getFkTipodocenteId() { return $this->fk_tipodocente_id; } - /** - * Get the [fk_cargobaja_id] column value. - * - * @return int - */ + public function getFkCargobajaId() { return $this->fk_cargobaja_id; } - /** - * Get the [fk_repeticion_id] column value. - * - * @return int - */ + public function getFkRepeticionId() { return $this->fk_repeticion_id; } - /** - * Get the [optionally formatted] [fecha_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaInicio($format = 'Y-m-d H:i:s') { if ($this->fecha_inicio === null || $this->fecha_inicio === '') { return null; } elseif (!is_int($this->fecha_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); + $ts = strtotime($this->fecha_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); } } else { $ts = $this->fecha_inicio; @@ -256,24 +146,15 @@ } } - /** - * Get the [optionally formatted] [fecha_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaFin($format = 'Y-m-d H:i:s') { if ($this->fecha_fin === null || $this->fecha_fin === '') { return null; } elseif (!is_int($this->fecha_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); + $ts = strtotime($this->fecha_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); } } else { $ts = $this->fecha_fin; @@ -287,24 +168,15 @@ } } - /** - * Get the [optionally formatted] [hora_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraInicio($format = '%X') + + public function getHoraInicio($format = 'H:i:s') { if ($this->hora_inicio === null || $this->hora_inicio === '') { return null; } elseif (!is_int($this->hora_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); + $ts = strtotime($this->hora_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); } } else { $ts = $this->hora_inicio; @@ -318,24 +190,15 @@ } } - /** - * Get the [optionally formatted] [hora_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraFin($format = '%X') + + public function getHoraFin($format = 'H:i:s') { if ($this->hora_fin === null || $this->hora_fin === '') { return null; } elseif (!is_int($this->hora_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); + $ts = strtotime($this->hora_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); } } else { $ts = $this->hora_fin; @@ -349,12 +212,7 @@ } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -363,14 +221,8 @@ $this->modifiedColumns[] = RelDivisionActividadDocentePeer::ID; } - } // setId() - - /** - * Set the value of [fk_division_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDivisionId($v) { @@ -383,14 +235,8 @@ $this->aDivision = null; } - } // setFkDivisionId() - - /** - * Set the value of [fk_actividad_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkActividadId($v) { @@ -403,14 +249,8 @@ $this->aActividad = null; } - } // setFkActividadId() - - /** - * Set the value of [fk_docente_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDocenteId($v) { @@ -423,14 +263,8 @@ $this->aDocente = null; } - } // setFkDocenteId() - - /** - * Set the value of [fk_tipodocente_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipodocenteId($v) { @@ -443,14 +277,8 @@ $this->aTipodocente = null; } - } // setFkTipodocenteId() - - /** - * Set the value of [fk_cargobaja_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCargobajaId($v) { @@ -463,14 +291,8 @@ $this->aCargobaja = null; } - } // setFkCargobajaId() - - /** - * Set the value of [fk_repeticion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkRepeticionId($v) { @@ -483,21 +305,14 @@ $this->aRepeticion = null; } - } // setFkRepeticionId() - - /** - * Set the value of [fecha_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -507,21 +322,14 @@ $this->modifiedColumns[] = RelDivisionActividadDocentePeer::FECHA_INICIO; } - } // setFechaInicio() - - /** - * Set the value of [fecha_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -531,21 +339,14 @@ $this->modifiedColumns[] = RelDivisionActividadDocentePeer::FECHA_FIN; } - } // setFechaFin() - - /** - * Set the value of [hora_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -555,21 +356,14 @@ $this->modifiedColumns[] = RelDivisionActividadDocentePeer::HORA_INICIO; } - } // setHoraInicio() - - /** - * Set the value of [hora_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -579,21 +373,8 @@ $this->modifiedColumns[] = RelDivisionActividadDocentePeer::HORA_FIN; } - } // setHoraFin() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -624,23 +405,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 11; // 11 = RelDivisionActividadDocentePeer::NUM_COLUMNS - RelDivisionActividadDocentePeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 11; } catch (Exception $e) { throw new PropelException("Error populating RelDivisionActividadDocente object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -662,16 +433,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -693,29 +455,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aDivision !== null) { if ($this->aDivision->isModified()) { $affectedRows += $this->aDivision->save($con); @@ -759,57 +506,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelDivisionActividadDocentePeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelDivisionActividadDocentePeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -822,16 +543,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -841,11 +553,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aDivision !== null) { if (!$this->aDivision->validate($columns)) { $failureMap = array_merge($failureMap, $this->aDivision->getValidationFailures()); @@ -895,28 +603,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelDivisionActividadDocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -956,19 +650,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelDivisionActividadDocentePeer::getFieldNames($keyType); @@ -988,30 +672,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelDivisionActividadDocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -1048,25 +716,9 @@ case 10: $this->setHoraFin($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelDivisionActividadDocentePeer::getFieldNames($keyType); @@ -1084,11 +736,7 @@ if (array_key_exists($keys[10], $arr)) $this->setHoraFin($arr[$keys[10]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelDivisionActividadDocentePeer::DATABASE_NAME); @@ -1108,14 +756,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelDivisionActividadDocentePeer::DATABASE_NAME); @@ -1125,36 +766,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelDivisionActividadDocente (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1181,40 +805,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelDivisionActividadDocente Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelDivisionActividadDocentePeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1223,13 +826,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Division object. - * - * @param Division $v - * @return void - * @throws PropelException - */ + public function setDivision($v) { @@ -1245,42 +842,21 @@ } - /** - * Get the associated Division object - * - * @param Connection Optional Connection object. - * @return Division The associated Division object. - * @throws PropelException - */ + public function getDivision($con = null) { - // include the related Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($this->aDivision === null && ($this->fk_division_id !== null)) { $this->aDivision = DivisionPeer::retrieveByPK($this->fk_division_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DivisionPeer::retrieveByPK($this->fk_division_id, $con); - $obj->addDivisions($this); - */ + } return $this->aDivision; } - /** - * Declares an association between this object and a Tipodocente object. - * - * @param Tipodocente $v - * @return void - * @throws PropelException - */ + public function setTipodocente($v) { @@ -1296,42 +872,21 @@ } - /** - * Get the associated Tipodocente object - * - * @param Connection Optional Connection object. - * @return Tipodocente The associated Tipodocente object. - * @throws PropelException - */ + public function getTipodocente($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipodocentePeer.php'; + include_once 'lib/model/om/BaseTipodocentePeer.php'; if ($this->aTipodocente === null && ($this->fk_tipodocente_id !== null)) { $this->aTipodocente = TipodocentePeer::retrieveByPK($this->fk_tipodocente_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipodocentePeer::retrieveByPK($this->fk_tipodocente_id, $con); - $obj->addTipodocentes($this); - */ + } return $this->aTipodocente; } - /** - * Declares an association between this object and a Cargobaja object. - * - * @param Cargobaja $v - * @return void - * @throws PropelException - */ + public function setCargobaja($v) { @@ -1347,42 +902,21 @@ } - /** - * Get the associated Cargobaja object - * - * @param Connection Optional Connection object. - * @return Cargobaja The associated Cargobaja object. - * @throws PropelException - */ + public function getCargobaja($con = null) { - // include the related Peer class - include_once 'model/om/BaseCargobajaPeer.php'; + include_once 'lib/model/om/BaseCargobajaPeer.php'; if ($this->aCargobaja === null && ($this->fk_cargobaja_id !== null)) { $this->aCargobaja = CargobajaPeer::retrieveByPK($this->fk_cargobaja_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CargobajaPeer::retrieveByPK($this->fk_cargobaja_id, $con); - $obj->addCargobajas($this); - */ + } return $this->aCargobaja; } - /** - * Declares an association between this object and a Docente object. - * - * @param Docente $v - * @return void - * @throws PropelException - */ + public function setDocente($v) { @@ -1398,42 +932,21 @@ } - /** - * Get the associated Docente object - * - * @param Connection Optional Connection object. - * @return Docente The associated Docente object. - * @throws PropelException - */ + public function getDocente($con = null) { - // include the related Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($this->aDocente === null && ($this->fk_docente_id !== null)) { $this->aDocente = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - $obj->addDocentes($this); - */ + } return $this->aDocente; } - /** - * Declares an association between this object and a Actividad object. - * - * @param Actividad $v - * @return void - * @throws PropelException - */ + public function setActividad($v) { @@ -1449,42 +962,21 @@ } - /** - * Get the associated Actividad object - * - * @param Connection Optional Connection object. - * @return Actividad The associated Actividad object. - * @throws PropelException - */ + public function getActividad($con = null) { - // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { $this->aActividad = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ActividadPeer::retrieveByPK($this->fk_actividad_id, $con); - $obj->addActividads($this); - */ + } return $this->aActividad; } - /** - * Declares an association between this object and a Repeticion object. - * - * @param Repeticion $v - * @return void - * @throws PropelException - */ + public function setRepeticion($v) { @@ -1500,33 +992,18 @@ } - /** - * Get the associated Repeticion object - * - * @param Connection Optional Connection object. - * @return Repeticion The associated Repeticion object. - * @throws PropelException - */ + public function getRepeticion($con = null) { - // include the related Peer class - include_once 'model/om/BaseRepeticionPeer.php'; + include_once 'lib/model/om/BaseRepeticionPeer.php'; if ($this->aRepeticion === null && ($this->fk_repeticion_id !== null)) { $this->aRepeticion = RepeticionPeer::retrieveByPK($this->fk_repeticion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = RepeticionPeer::retrieveByPK($this->fk_repeticion_id, $con); - $obj->addRepeticions($this); - */ + } return $this->aRepeticion; } -} // BaseRelDivisionActividadDocente +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadDocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,78 +1,62 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelDivisionActividadDocentePeer::getOMClass() -include_once 'model/RelDivisionActividadDocente.php'; -/** - * Base static class for performing query and update operations on the 'rel_division_actividad_docente' table. - * - * - * - * @package model.om - */ abstract class BaseRelDivisionActividadDocentePeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_division_actividad_docente'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelDivisionActividadDocente'; + + const CLASS_DEFAULT = 'lib.model.RelDivisionActividadDocente'; - /** The total number of columns. */ + const NUM_COLUMNS = 11; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_division_actividad_docente.ID'; - /** the column name for the FK_DIVISION_ID field */ + const FK_DIVISION_ID = 'rel_division_actividad_docente.FK_DIVISION_ID'; - /** the column name for the FK_ACTIVIDAD_ID field */ + const FK_ACTIVIDAD_ID = 'rel_division_actividad_docente.FK_ACTIVIDAD_ID'; - /** the column name for the FK_DOCENTE_ID field */ + const FK_DOCENTE_ID = 'rel_division_actividad_docente.FK_DOCENTE_ID'; - /** the column name for the FK_TIPODOCENTE_ID field */ + const FK_TIPODOCENTE_ID = 'rel_division_actividad_docente.FK_TIPODOCENTE_ID'; - /** the column name for the FK_CARGOBAJA_ID field */ + const FK_CARGOBAJA_ID = 'rel_division_actividad_docente.FK_CARGOBAJA_ID'; - /** the column name for the FK_REPETICION_ID field */ + const FK_REPETICION_ID = 'rel_division_actividad_docente.FK_REPETICION_ID'; - /** the column name for the FECHA_INICIO field */ + const FECHA_INICIO = 'rel_division_actividad_docente.FECHA_INICIO'; - /** the column name for the FECHA_FIN field */ + const FECHA_FIN = 'rel_division_actividad_docente.FECHA_FIN'; - /** the column name for the HORA_INICIO field */ + const HORA_INICIO = 'rel_division_actividad_docente.HORA_INICIO'; - /** the column name for the HORA_FIN field */ + const HORA_FIN = 'rel_division_actividad_docente.HORA_FIN'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkDivisionId', 'FkActividadId', 'FkDocenteId', 'FkTipodocenteId', 'FkCargobajaId', 'FkRepeticionId', 'FechaInicio', 'FechaFin', 'HoraInicio', 'HoraFin', ), BasePeer::TYPE_COLNAME => array (RelDivisionActividadDocentePeer::ID, RelDivisionActividadDocentePeer::FK_DIVISION_ID, RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID, RelDivisionActividadDocentePeer::FK_DOCENTE_ID, RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID, RelDivisionActividadDocentePeer::FK_REPETICION_ID, RelDivisionActividadDocentePeer::FECHA_INICIO, RelDivisionActividadDocentePeer::FECHA_FIN, RelDivisionActividadDocentePeer::HORA_INICIO, RelDivisionActividadDocentePeer::HORA_FIN, ), @@ -80,12 +64,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkDivisionId' => 1, 'FkActividadId' => 2, 'FkDocenteId' => 3, 'FkTipodocenteId' => 4, 'FkCargobajaId' => 5, 'FkRepeticionId' => 6, 'FechaInicio' => 7, 'FechaFin' => 8, 'HoraInicio' => 9, 'HoraFin' => 10, ), BasePeer::TYPE_COLNAME => array (RelDivisionActividadDocentePeer::ID => 0, RelDivisionActividadDocentePeer::FK_DIVISION_ID => 1, RelDivisionActividadDocentePeer::FK_ACTIVIDAD_ID => 2, RelDivisionActividadDocentePeer::FK_DOCENTE_ID => 3, RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID => 4, RelDivisionActividadDocentePeer::FK_CARGOBAJA_ID => 5, RelDivisionActividadDocentePeer::FK_REPETICION_ID => 6, RelDivisionActividadDocentePeer::FECHA_INICIO => 7, RelDivisionActividadDocentePeer::FECHA_FIN => 8, RelDivisionActividadDocentePeer::HORA_INICIO => 9, RelDivisionActividadDocentePeer::HORA_FIN => 10, ), @@ -93,24 +72,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelDivisionActividadDocenteMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelDivisionActividadDocenteMapBuilder'); + include_once 'lib/model/map/RelDivisionActividadDocenteMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelDivisionActividadDocenteMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -124,15 +92,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -143,14 +103,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -160,34 +113,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelDivisionActividadDocentePeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelDivisionActividadDocentePeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -218,29 +150,19 @@ const COUNT = 'COUNT(rel_division_actividad_docente.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_division_actividad_docente.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -249,19 +171,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelDivisionActividadDocente - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -272,33 +185,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelDivisionActividadDocentePeer::populateObjects(RelDivisionActividadDocentePeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -310,29 +202,18 @@ RelDivisionActividadDocentePeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelDivisionActividadDocentePeer::getOMClass(); + $cls = RelDivisionActividadDocentePeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -342,29 +223,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Division table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDivision(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -375,35 +246,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipodocente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipodocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -414,35 +274,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Cargobaja table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCargobaja(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -453,35 +302,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -492,35 +330,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -531,35 +358,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Repeticion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinRepeticion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -570,25 +386,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with their Division objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDivision(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -616,37 +424,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDivisionActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelDivisionActividadDocentes(); - $obj2->addRelDivisionActividadDocente($obj1); //CHECKME - } + $obj2->addRelDivisionActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with their Tipodocente objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipodocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -674,37 +471,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipodocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDivisionActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelDivisionActividadDocentes(); - $obj2->addRelDivisionActividadDocente($obj1); //CHECKME - } + $obj2->addRelDivisionActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with their Cargobaja objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCargobaja(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -732,37 +518,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCargobaja(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCargobaja(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDivisionActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelDivisionActividadDocentes(); - $obj2->addRelDivisionActividadDocente($obj1); //CHECKME - } + $obj2->addRelDivisionActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with their Docente objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -790,37 +565,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDivisionActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelDivisionActividadDocentes(); - $obj2->addRelDivisionActividadDocente($obj1); //CHECKME - } + $obj2->addRelDivisionActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with their Actividad objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -848,37 +612,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getActividad(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDivisionActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelDivisionActividadDocentes(); - $obj2->addRelDivisionActividadDocente($obj1); //CHECKME - } + $obj2->addRelDivisionActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with their Repeticion objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinRepeticion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -906,46 +659,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDivisionActividadDocente($obj1); //CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } if ($newObject) { $obj2->initRelDivisionActividadDocentes(); - $obj2->addRelDivisionActividadDocente($obj1); //CHECKME - } + $obj2->addRelDivisionActividadDocente($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -966,25 +706,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1034,8 +766,7 @@ $obj1->hydrate($rs); - // Add objects for joined Division rows - + $omClass = DivisionPeer::getOMClass(); @@ -1046,11 +777,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelDivisionActividadDocente($obj1); // CHECKME - break; + $temp_obj2->addRelDivisionActividadDocente($obj1); break; } } @@ -1060,8 +789,7 @@ } - // Add objects for joined Tipodocente rows - + $omClass = TipodocentePeer::getOMClass(); @@ -1072,11 +800,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocente(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocente(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelDivisionActividadDocente($obj1); // CHECKME - break; + $temp_obj3->addRelDivisionActividadDocente($obj1); break; } } @@ -1086,8 +812,7 @@ } - // Add objects for joined Cargobaja rows - + $omClass = CargobajaPeer::getOMClass(); @@ -1098,11 +823,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getCargobaja(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getCargobaja(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addRelDivisionActividadDocente($obj1); // CHECKME - break; + $temp_obj4->addRelDivisionActividadDocente($obj1); break; } } @@ -1112,8 +835,7 @@ } - // Add objects for joined Docente rows - + $omClass = DocentePeer::getOMClass(); @@ -1124,11 +846,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getDocente(); // CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getDocente(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; - $temp_obj5->addRelDivisionActividadDocente($obj1); // CHECKME - break; + $temp_obj5->addRelDivisionActividadDocente($obj1); break; } } @@ -1138,8 +858,7 @@ } - // Add objects for joined Actividad rows - + $omClass = ActividadPeer::getOMClass(); @@ -1150,11 +869,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getActividad(); // CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getActividad(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; - $temp_obj6->addRelDivisionActividadDocente($obj1); // CHECKME - break; + $temp_obj6->addRelDivisionActividadDocente($obj1); break; } } @@ -1164,8 +881,7 @@ } - // Add objects for joined Repeticion rows - + $omClass = RepeticionPeer::getOMClass(); @@ -1176,11 +892,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj7 = $temp_obj1->getRepeticion(); // CHECKME - if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { + $temp_obj7 = $temp_obj1->getRepeticion(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; - $temp_obj7->addRelDivisionActividadDocente($obj1); // CHECKME - break; + $temp_obj7->addRelDivisionActividadDocente($obj1); break; } } @@ -1195,29 +909,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Division table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDivision(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1236,35 +940,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipodocente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipodocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1283,35 +976,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Cargobaja table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptCargobaja(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1330,35 +1012,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1377,35 +1048,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Actividad table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptActividad(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1424,35 +1084,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Repeticion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptRepeticion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDivisionActividadDocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -1471,27 +1120,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects except Division. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDivision(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1545,8 +1184,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getTipodocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDivisionActividadDocente($obj1); break; @@ -1568,8 +1206,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCargobaja(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCargobaja(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addRelDivisionActividadDocente($obj1); break; @@ -1591,8 +1228,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getDocente(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addRelDivisionActividadDocente($obj1); break; @@ -1614,8 +1250,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getActividad(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addRelDivisionActividadDocente($obj1); break; @@ -1637,8 +1272,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getRepeticion(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addRelDivisionActividadDocente($obj1); break; @@ -1656,21 +1290,12 @@ } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects except Tipodocente. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipodocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1724,8 +1349,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDivisionActividadDocente($obj1); break; @@ -1747,8 +1371,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getCargobaja(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getCargobaja(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addRelDivisionActividadDocente($obj1); break; @@ -1770,8 +1393,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getDocente(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addRelDivisionActividadDocente($obj1); break; @@ -1793,8 +1415,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getActividad(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addRelDivisionActividadDocente($obj1); break; @@ -1816,8 +1437,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getRepeticion(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addRelDivisionActividadDocente($obj1); break; @@ -1835,21 +1455,12 @@ } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects except Cargobaja. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptCargobaja(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1903,8 +1514,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDivisionActividadDocente($obj1); break; @@ -1926,8 +1536,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocente(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocente(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addRelDivisionActividadDocente($obj1); break; @@ -1949,8 +1558,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getDocente(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addRelDivisionActividadDocente($obj1); break; @@ -1972,8 +1580,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getActividad(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addRelDivisionActividadDocente($obj1); break; @@ -1995,8 +1602,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getRepeticion(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addRelDivisionActividadDocente($obj1); break; @@ -2014,21 +1620,12 @@ } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects except Docente. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -2082,8 +1679,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDivisionActividadDocente($obj1); break; @@ -2105,8 +1701,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocente(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocente(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addRelDivisionActividadDocente($obj1); break; @@ -2128,8 +1723,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getCargobaja(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getCargobaja(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addRelDivisionActividadDocente($obj1); break; @@ -2151,8 +1745,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getActividad(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addRelDivisionActividadDocente($obj1); break; @@ -2174,8 +1767,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getRepeticion(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addRelDivisionActividadDocente($obj1); break; @@ -2193,21 +1785,12 @@ } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects except Actividad. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptActividad(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -2261,8 +1844,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDivisionActividadDocente($obj1); break; @@ -2284,8 +1866,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocente(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocente(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addRelDivisionActividadDocente($obj1); break; @@ -2307,8 +1888,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getCargobaja(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getCargobaja(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addRelDivisionActividadDocente($obj1); break; @@ -2330,8 +1910,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getDocente(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addRelDivisionActividadDocente($obj1); break; @@ -2353,8 +1932,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getRepeticion(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getRepeticion(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addRelDivisionActividadDocente($obj1); break; @@ -2372,21 +1950,12 @@ } - /** - * Selects a collection of RelDivisionActividadDocente objects pre-filled with all related objects except Repeticion. - * - * @return array Array of RelDivisionActividadDocente objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptRepeticion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -2440,8 +2009,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDivision(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDivision(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDivisionActividadDocente($obj1); break; @@ -2463,8 +2031,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocente(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocente(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addRelDivisionActividadDocente($obj1); break; @@ -2486,8 +2053,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getCargobaja(); //CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getCargobaja(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addRelDivisionActividadDocente($obj1); break; @@ -2509,8 +2075,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj5 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { + $temp_obj5 = $temp_obj1->getDocente(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addRelDivisionActividadDocente($obj1); break; @@ -2532,8 +2097,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj6 = $temp_obj1->getActividad(); //CHECKME - if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { + $temp_obj6 = $temp_obj1->getActividad(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addRelDivisionActividadDocente($obj1); break; @@ -2550,41 +2114,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelDivisionActividadDocentePeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelDivisionActividadDocente or Criteria object. - * - * @param mixed $values Criteria or RelDivisionActividadDocente object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -2592,21 +2134,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelDivisionActividadDocente object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelDivisionActividadDocentePeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelDivisionActividadDocentePeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -2617,15 +2153,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelDivisionActividadDocente or Criteria object. - * - * @param mixed $values Criteria or RelDivisionActividadDocente object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -2635,37 +2163,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelDivisionActividadDocentePeer::ID); $selectCriteria->add(RelDivisionActividadDocentePeer::ID, $criteria->remove(RelDivisionActividadDocentePeer::ID), $comparison); - } else { // $values is RelDivisionActividadDocente object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_division_actividad_docente table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelDivisionActividadDocentePeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -2675,17 +2191,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelDivisionActividadDocente or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelDivisionActividadDocente object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -2693,25 +2199,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelDivisionActividadDocente) { + $criteria = clone $values; } elseif ($values instanceof RelDivisionActividadDocente) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelDivisionActividadDocentePeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -2722,18 +2222,7 @@ } } - /** - * Validates all modified columns of given RelDivisionActividadDocente object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelDivisionActividadDocente $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelDivisionActividadDocente $obj, $cols = null) { $columns = array(); @@ -2768,13 +2257,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelDivisionActividadDocente - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -2791,14 +2274,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -2816,20 +2292,14 @@ return $objs; } -} // BaseRelDivisionActividadDocentePeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelDivisionActividadDocentePeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelDivisionActividadDocenteMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelDivisionActividadDocenteMapBuilder'); + require_once 'lib/model/map/RelDivisionActividadDocenteMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelDivisionActividadDocenteMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelDivisionActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -3,7 +3,7 @@ require_once 'propel/util/BasePeer.php'; // The object class -- needed for instanceof checks in this class. // actual class may be a subclass -- as returned by RelDivisionActividadPeer::getOMClass() -include_once 'model/RelDivisionActividad.php'; +include_once 'lib/model/RelDivisionActividad.php'; /** * Base static class for performing query and update operations on the 'rel_division_actividad' table. @@ -91,7 +91,7 @@ */ public static function getMapBuilder() { - include_once 'model/map/RelDivisionActividadMapBuilder.php'; + include_once 'lib/model/map/RelDivisionActividadMapBuilder.php'; return BasePeer::getMapBuilder('model.map.RelDivisionActividadMapBuilder'); } /** @@ -1477,6 +1477,6 @@ } else { // even if Propel is not yet initialized, the map builder class can be registered // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelDivisionActividadMapBuilder.php'; + require_once 'lib/model/map/RelDivisionActividadMapBuilder.php'; Propel::registerMapBuilder('model.map.RelDivisionActividadMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimiento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimiento.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimiento.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,98 +1,47 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelDocenteEstablecimientoPeer.php'; - -/** - * Base class that represents a row from the 'rel_docente_establecimiento' table. - * - * - * - * @package model.om - */ abstract class BaseRelDocenteEstablecimiento extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelDocenteEstablecimientoPeer - */ + protected static $peer; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the fk_docente_id field. - * @var int - */ + protected $fk_docente_id = 0; - /** - * @var Docente - */ + protected $aDocente; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [fk_docente_id] column value. - * - * @return int - */ + public function getFkDocenteId() { return $this->fk_docente_id; } - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + public function setFkEstablecimientoId($v) { @@ -105,14 +54,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [fk_docente_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkDocenteId($v) { @@ -125,21 +68,8 @@ $this->aDocente = null; } - } // setFkDocenteId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -152,23 +82,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 2; // 2 = RelDocenteEstablecimientoPeer::NUM_COLUMNS - RelDocenteEstablecimientoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 2; } catch (Exception $e) { throw new PropelException("Error populating RelDocenteEstablecimiento object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -190,16 +110,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -221,29 +132,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aDocente !== null) { if ($this->aDocente->isModified()) { $affectedRows += $this->aDocente->save($con); @@ -259,55 +155,30 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelDocenteEstablecimientoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - + $affectedRows += 1; $this->setNew(false); } else { $affectedRows += RelDocenteEstablecimientoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -320,16 +191,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -339,11 +201,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aDocente !== null) { if (!$this->aDocente->validate($columns)) { $failureMap = array_merge($failureMap, $this->aDocente->getValidationFailures()); @@ -369,28 +227,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelDocenteEstablecimientoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -403,19 +247,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelDocenteEstablecimientoPeer::getFieldNames($keyType); @@ -426,30 +260,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelDocenteEstablecimientoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -459,25 +277,9 @@ case 1: $this->setFkDocenteId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelDocenteEstablecimientoPeer::getFieldNames($keyType); @@ -486,11 +288,7 @@ if (array_key_exists($keys[1], $arr)) $this->setFkDocenteId($arr[$keys[1]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelDocenteEstablecimientoPeer::DATABASE_NAME); @@ -501,14 +299,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelDocenteEstablecimientoPeer::DATABASE_NAME); @@ -517,40 +308,18 @@ return $criteria; } - /** - * Returns NULL since this table doesn't have a primary key. - * This method exists only for BC and is deprecated! - * @return null - */ + public function getPrimaryKey() { return null; } - /** - * Dummy primary key setter. - * - * This function only exists to preserve backwards compatibility. It is no longer - * needed or required by the Persistent interface. It will be removed in next BC-breaking - * release of Propel. - * - * @deprecated - */ + public function setPrimaryKey($pk) { - // do nothing, because this object doesn't have any primary keys - } + } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelDocenteEstablecimiento (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -563,36 +332,16 @@ } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelDocenteEstablecimiento Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelDocenteEstablecimientoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -601,13 +350,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Docente object. - * - * @param Docente $v - * @return void - * @throws PropelException - */ + public function setDocente($v) { @@ -623,42 +366,21 @@ } - /** - * Get the associated Docente object - * - * @param Connection Optional Connection object. - * @return Docente The associated Docente object. - * @throws PropelException - */ + public function getDocente($con = null) { - // include the related Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($this->aDocente === null && ($this->fk_docente_id !== null)) { $this->aDocente = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = DocentePeer::retrieveByPK($this->fk_docente_id, $con); - $obj->addDocentes($this); - */ + } return $this->aDocente; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -674,33 +396,18 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } -} // BaseRelDocenteEstablecimiento +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimientoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimientoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelDocenteEstablecimientoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,51 +1,35 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelDocenteEstablecimientoPeer::getOMClass() -include_once 'model/RelDocenteEstablecimiento.php'; -/** - * Base static class for performing query and update operations on the 'rel_docente_establecimiento' table. - * - * - * - * @package model.om - */ abstract class BaseRelDocenteEstablecimientoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_docente_establecimiento'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelDocenteEstablecimiento'; + + const CLASS_DEFAULT = 'lib.model.RelDocenteEstablecimiento'; - /** The total number of columns. */ + const NUM_COLUMNS = 2; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'rel_docente_establecimiento.FK_ESTABLECIMIENTO_ID'; - /** the column name for the FK_DOCENTE_ID field */ + const FK_DOCENTE_ID = 'rel_docente_establecimiento.FK_DOCENTE_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('FkEstablecimientoId', 'FkDocenteId', ), BasePeer::TYPE_COLNAME => array (RelDocenteEstablecimientoPeer::FK_ESTABLECIMIENTO_ID, RelDocenteEstablecimientoPeer::FK_DOCENTE_ID, ), @@ -53,12 +37,7 @@ BasePeer::TYPE_NUM => array (0, 1, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('FkEstablecimientoId' => 0, 'FkDocenteId' => 1, ), BasePeer::TYPE_COLNAME => array (RelDocenteEstablecimientoPeer::FK_ESTABLECIMIENTO_ID => 0, RelDocenteEstablecimientoPeer::FK_DOCENTE_ID => 1, ), @@ -66,24 +45,13 @@ BasePeer::TYPE_NUM => array (0, 1, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelDocenteEstablecimientoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelDocenteEstablecimientoMapBuilder'); + include_once 'lib/model/map/RelDocenteEstablecimientoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelDocenteEstablecimientoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -97,15 +65,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -116,14 +76,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -133,34 +86,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelDocenteEstablecimientoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelDocenteEstablecimientoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -173,29 +105,19 @@ const COUNT = 'COUNT(*)'; const COUNT_DISTINCT = 'COUNT(DISTINCT *)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -204,19 +126,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelDocenteEstablecimiento - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -227,33 +140,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelDocenteEstablecimientoPeer::populateObjects(RelDocenteEstablecimientoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -265,29 +157,18 @@ RelDocenteEstablecimientoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelDocenteEstablecimientoPeer::getOMClass(); + $cls = RelDocenteEstablecimientoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -297,29 +178,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -330,35 +201,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -369,25 +229,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelDocenteEstablecimiento objects pre-filled with their Docente objects. - * - * @return array Array of RelDocenteEstablecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -415,37 +267,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDocenteEstablecimiento($obj1); //CHECKME - break; + $temp_obj2->addRelDocenteEstablecimiento($obj1); break; } } if ($newObject) { $obj2->initRelDocenteEstablecimientos(); - $obj2->addRelDocenteEstablecimiento($obj1); //CHECKME - } + $obj2->addRelDocenteEstablecimiento($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelDocenteEstablecimiento objects pre-filled with their Establecimiento objects. - * - * @return array Array of RelDocenteEstablecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -473,46 +314,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelDocenteEstablecimiento($obj1); //CHECKME - break; + $temp_obj2->addRelDocenteEstablecimiento($obj1); break; } } if ($newObject) { $obj2->initRelDocenteEstablecimientos(); - $obj2->addRelDocenteEstablecimiento($obj1); //CHECKME - } + $obj2->addRelDocenteEstablecimiento($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -525,25 +353,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelDocenteEstablecimiento objects pre-filled with all related objects. - * - * @return array Array of RelDocenteEstablecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -573,8 +393,7 @@ $obj1->hydrate($rs); - // Add objects for joined Docente rows - + $omClass = DocentePeer::getOMClass(); @@ -585,11 +404,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDocente(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelDocenteEstablecimiento($obj1); // CHECKME - break; + $temp_obj2->addRelDocenteEstablecimiento($obj1); break; } } @@ -599,8 +416,7 @@ } - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -611,11 +427,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getEstablecimiento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelDocenteEstablecimiento($obj1); // CHECKME - break; + $temp_obj3->addRelDocenteEstablecimiento($obj1); break; } } @@ -630,29 +444,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Docente table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptDocente(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -663,35 +467,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelDocenteEstablecimientoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -702,27 +495,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelDocenteEstablecimiento objects pre-filled with all related objects except Docente. - * - * @return array Array of RelDocenteEstablecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptDocente(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -756,8 +539,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDocenteEstablecimiento($obj1); break; @@ -775,21 +557,12 @@ } - /** - * Selects a collection of RelDocenteEstablecimiento objects pre-filled with all related objects except Establecimiento. - * - * @return array Array of RelDocenteEstablecimiento objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -823,8 +596,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getDocente(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getDocente(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelDocenteEstablecimiento($obj1); break; @@ -841,41 +613,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelDocenteEstablecimientoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelDocenteEstablecimiento or Criteria object. - * - * @param mixed $values Criteria or RelDocenteEstablecimiento object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -883,19 +633,14 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelDocenteEstablecimiento object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -906,15 +651,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelDocenteEstablecimiento or Criteria object. - * - * @param mixed $values Criteria or RelDocenteEstablecimiento object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -924,34 +661,22 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity + $criteria = clone $values; + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - } else { // $values is RelDocenteEstablecimiento object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + $criteria->setDbName(self::DATABASE_NAME); - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_docente_establecimiento table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelDocenteEstablecimientoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -961,17 +686,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelDocenteEstablecimiento or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelDocenteEstablecimiento object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -979,20 +694,14 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelDocenteEstablecimiento) { + $criteria = clone $values; } elseif ($values instanceof RelDocenteEstablecimiento) { $criteria = $values->buildCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); - // primary key is composite; we therefore, expect - // the primary key passed to be an array of pkey - // values - if(count($values) == count($values, COUNT_RECURSIVE)) + $criteria = new Criteria(self::DATABASE_NAME); + if(count($values) == count($values, COUNT_RECURSIVE)) { - // array is not multi-dimensional - $values = array($values); + $values = array($values); } $vals = array(); foreach($values as $value) @@ -1002,15 +711,11 @@ } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1021,18 +726,7 @@ } } - /** - * Validates all modified columns of given RelDocenteEstablecimiento object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelDocenteEstablecimiento $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelDocenteEstablecimiento $obj, $cols = null) { $columns = array(); @@ -1067,20 +761,14 @@ return $res; } -} // BaseRelDocenteEstablecimientoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelDocenteEstablecimientoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelDocenteEstablecimientoMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelDocenteEstablecimientoMapBuilder'); + require_once 'lib/model/map/RelDocenteEstablecimientoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelDocenteEstablecimientoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,116 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelEstablecimientoLocacionPeer.php'; - -/** - * Base class that represents a row from the 'rel_establecimiento_locacion' table. - * - * - * - * @package model.om - */ abstract class BaseRelEstablecimientoLocacion extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelEstablecimientoLocacionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the fk_locacion_id field. - * @var int - */ + protected $fk_locacion_id = 0; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * @var Locacion - */ + protected $aLocacion; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [fk_locacion_id] column value. - * - * @return int - */ + public function getFkLocacionId() { return $this->fk_locacion_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -119,14 +61,8 @@ $this->modifiedColumns[] = RelEstablecimientoLocacionPeer::ID; } - } // setId() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -139,14 +75,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [fk_locacion_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkLocacionId($v) { @@ -159,21 +89,8 @@ $this->aLocacion = null; } - } // setFkLocacionId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -188,23 +105,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RelEstablecimientoLocacionPeer::NUM_COLUMNS - RelEstablecimientoLocacionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating RelEstablecimientoLocacion object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -226,16 +133,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -257,29 +155,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -295,57 +178,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelEstablecimientoLocacionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelEstablecimientoLocacionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -358,16 +215,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -377,11 +225,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -407,28 +251,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelEstablecimientoLocacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -444,19 +274,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelEstablecimientoLocacionPeer::getFieldNames($keyType); @@ -468,30 +288,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelEstablecimientoLocacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -504,25 +308,9 @@ case 2: $this->setFkLocacionId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelEstablecimientoLocacionPeer::getFieldNames($keyType); @@ -532,11 +320,7 @@ if (array_key_exists($keys[2], $arr)) $this->setFkLocacionId($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelEstablecimientoLocacionPeer::DATABASE_NAME); @@ -548,14 +332,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelEstablecimientoLocacionPeer::DATABASE_NAME); @@ -565,36 +342,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelEstablecimientoLocacion (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -605,40 +365,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelEstablecimientoLocacion Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelEstablecimientoLocacionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -647,13 +386,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -669,42 +402,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Declares an association between this object and a Locacion object. - * - * @param Locacion $v - * @return void - * @throws PropelException - */ + public function setLocacion($v) { @@ -720,33 +432,18 @@ } - /** - * Get the associated Locacion object - * - * @param Connection Optional Connection object. - * @return Locacion The associated Locacion object. - * @throws PropelException - */ + public function getLocacion($con = null) { - // include the related Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($this->aLocacion === null && ($this->fk_locacion_id !== null)) { $this->aLocacion = LocacionPeer::retrieveByPK($this->fk_locacion_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = LocacionPeer::retrieveByPK($this->fk_locacion_id, $con); - $obj->addLocacions($this); - */ + } return $this->aLocacion; } -} // BaseRelEstablecimientoLocacion +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelEstablecimientoLocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelEstablecimientoLocacionPeer::getOMClass() -include_once 'model/RelEstablecimientoLocacion.php'; -/** - * Base static class for performing query and update operations on the 'rel_establecimiento_locacion' table. - * - * - * - * @package model.om - */ abstract class BaseRelEstablecimientoLocacionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_establecimiento_locacion'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelEstablecimientoLocacion'; + + const CLASS_DEFAULT = 'lib.model.RelEstablecimientoLocacion'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_establecimiento_locacion.ID'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'rel_establecimiento_locacion.FK_ESTABLECIMIENTO_ID'; - /** the column name for the FK_LOCACION_ID field */ + const FK_LOCACION_ID = 'rel_establecimiento_locacion.FK_LOCACION_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkEstablecimientoId', 'FkLocacionId', ), BasePeer::TYPE_COLNAME => array (RelEstablecimientoLocacionPeer::ID, RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, RelEstablecimientoLocacionPeer::FK_LOCACION_ID, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkEstablecimientoId' => 1, 'FkLocacionId' => 2, ), BasePeer::TYPE_COLNAME => array (RelEstablecimientoLocacionPeer::ID => 0, RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID => 1, RelEstablecimientoLocacionPeer::FK_LOCACION_ID => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelEstablecimientoLocacionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelEstablecimientoLocacionMapBuilder'); + include_once 'lib/model/map/RelEstablecimientoLocacionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelEstablecimientoLocacionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelEstablecimientoLocacionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelEstablecimientoLocacionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(rel_establecimiento_locacion.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_establecimiento_locacion.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelEstablecimientoLocacion - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelEstablecimientoLocacionPeer::populateObjects(RelEstablecimientoLocacionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RelEstablecimientoLocacionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelEstablecimientoLocacionPeer::getOMClass(); + $cls = RelEstablecimientoLocacionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -302,29 +183,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -335,35 +206,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Locacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinLocacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -374,25 +234,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelEstablecimientoLocacion objects pre-filled with their Establecimiento objects. - * - * @return array Array of RelEstablecimientoLocacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -420,37 +272,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelEstablecimientoLocacion($obj1); //CHECKME - break; + $temp_obj2->addRelEstablecimientoLocacion($obj1); break; } } if ($newObject) { $obj2->initRelEstablecimientoLocacions(); - $obj2->addRelEstablecimientoLocacion($obj1); //CHECKME - } + $obj2->addRelEstablecimientoLocacion($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelEstablecimientoLocacion objects pre-filled with their Locacion objects. - * - * @return array Array of RelEstablecimientoLocacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinLocacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -478,46 +319,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getLocacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLocacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelEstablecimientoLocacion($obj1); //CHECKME - break; + $temp_obj2->addRelEstablecimientoLocacion($obj1); break; } } if ($newObject) { $obj2->initRelEstablecimientoLocacions(); - $obj2->addRelEstablecimientoLocacion($obj1); //CHECKME - } + $obj2->addRelEstablecimientoLocacion($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -530,25 +358,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelEstablecimientoLocacion objects pre-filled with all related objects. - * - * @return array Array of RelEstablecimientoLocacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -578,8 +398,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -590,11 +409,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelEstablecimientoLocacion($obj1); // CHECKME - break; + $temp_obj2->addRelEstablecimientoLocacion($obj1); break; } } @@ -604,8 +421,7 @@ } - // Add objects for joined Locacion rows - + $omClass = LocacionPeer::getOMClass(); @@ -616,11 +432,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getLocacion(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getLocacion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelEstablecimientoLocacion($obj1); // CHECKME - break; + $temp_obj3->addRelEstablecimientoLocacion($obj1); break; } } @@ -635,29 +449,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -668,35 +472,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Locacion table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptLocacion(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelEstablecimientoLocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -707,27 +500,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelEstablecimientoLocacion objects pre-filled with all related objects except Establecimiento. - * - * @return array Array of RelEstablecimientoLocacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -761,8 +544,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getLocacion(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getLocacion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelEstablecimientoLocacion($obj1); break; @@ -780,21 +562,12 @@ } - /** - * Selects a collection of RelEstablecimientoLocacion objects pre-filled with all related objects except Locacion. - * - * @return array Array of RelEstablecimientoLocacion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptLocacion(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -828,8 +601,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelEstablecimientoLocacion($obj1); break; @@ -846,41 +618,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelEstablecimientoLocacionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelEstablecimientoLocacion or Criteria object. - * - * @param mixed $values Criteria or RelEstablecimientoLocacion object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -888,21 +638,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelEstablecimientoLocacion object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelEstablecimientoLocacionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelEstablecimientoLocacionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -913,15 +657,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelEstablecimientoLocacion or Criteria object. - * - * @param mixed $values Criteria or RelEstablecimientoLocacion object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -931,37 +667,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelEstablecimientoLocacionPeer::ID); $selectCriteria->add(RelEstablecimientoLocacionPeer::ID, $criteria->remove(RelEstablecimientoLocacionPeer::ID), $comparison); - } else { // $values is RelEstablecimientoLocacion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_establecimiento_locacion table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelEstablecimientoLocacionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -971,17 +695,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelEstablecimientoLocacion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelEstablecimientoLocacion object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -989,25 +703,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelEstablecimientoLocacion) { + $criteria = clone $values; } elseif ($values instanceof RelEstablecimientoLocacion) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelEstablecimientoLocacionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1018,18 +726,7 @@ } } - /** - * Validates all modified columns of given RelEstablecimientoLocacion object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelEstablecimientoLocacion $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelEstablecimientoLocacion $obj, $cols = null) { $columns = array(); @@ -1064,13 +761,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelEstablecimientoLocacion - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1087,14 +778,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1112,20 +796,14 @@ return $objs; } -} // BaseRelEstablecimientoLocacionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelEstablecimientoLocacionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelEstablecimientoLocacionMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelEstablecimientoLocacionMapBuilder'); + require_once 'lib/model/map/RelEstablecimientoLocacionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelEstablecimientoLocacionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -7,7 +7,7 @@ include_once 'propel/util/Criteria.php'; -include_once 'model/RelLocacionEspacioPeer.php'; +include_once 'lib/model/RelLocacionEspacioPeer.php'; /** * Base class that represents a row from the 'rel_locacion_espacio' table. @@ -679,7 +679,7 @@ public function getLocacion($con = null) { // include the related Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($this->aLocacion === null && ($this->fk_locacion_id !== null)) { @@ -730,7 +730,7 @@ public function getEspacio($con = null) { // include the related Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($this->aEspacio === null && ($this->fk_espacio_id !== null)) { Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelLocacionEspacioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -3,7 +3,7 @@ require_once 'propel/util/BasePeer.php'; // The object class -- needed for instanceof checks in this class. // actual class may be a subclass -- as returned by RelLocacionEspacioPeer::getOMClass() -include_once 'model/RelLocacionEspacio.php'; +include_once 'lib/model/RelLocacionEspacio.php'; /** * Base static class for performing query and update operations on the 'rel_locacion_espacio' table. @@ -76,7 +76,7 @@ */ public static function getMapBuilder() { - include_once 'model/map/RelLocacionEspacioMapBuilder.php'; + include_once 'lib/model/map/RelLocacionEspacioMapBuilder.php'; return BasePeer::getMapBuilder('model.map.RelLocacionEspacioMapBuilder'); } /** @@ -1126,6 +1126,6 @@ } else { // even if Propel is not yet initialized, the map builder class can be registered // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelLocacionEspacioMapBuilder.php'; + require_once 'lib/model/map/RelLocacionEspacioMapBuilder.php'; Propel::registerMapBuilder('model.map.RelLocacionEspacioMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -7,7 +7,7 @@ include_once 'propel/util/Criteria.php'; -include_once 'model/RelNivelLocacionPeer.php'; +include_once 'lib/model/RelNivelLocacionPeer.php'; /** * Base class that represents a row from the 'rel_nivel_locacion' table. Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelNivelLocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -3,7 +3,7 @@ require_once 'propel/util/BasePeer.php'; // The object class -- needed for instanceof checks in this class. // actual class may be a subclass -- as returned by RelNivelLocacionPeer::getOMClass() -include_once 'model/RelNivelLocacion.php'; +include_once 'lib/model/RelNivelLocacion.php'; /** * Base static class for performing query and update operations on the 'rel_nivel_locacion' table. @@ -76,7 +76,7 @@ */ public static function getMapBuilder() { - include_once 'model/map/RelNivelLocacionMapBuilder.php'; + include_once 'lib/model/map/RelNivelLocacionMapBuilder.php'; return BasePeer::getMapBuilder('model.map.RelNivelLocacionMapBuilder'); } /** @@ -580,6 +580,6 @@ } else { // even if Propel is not yet initialized, the map builder class can be registered // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelNivelLocacionMapBuilder.php'; + require_once 'lib/model/map/RelNivelLocacionMapBuilder.php'; Propel::registerMapBuilder('model.map.RelNivelLocacionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermiso.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermiso.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermiso.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,116 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelRolPermisoPeer.php'; - -/** - * Base class that represents a row from the 'rel_rol_permiso' table. - * - * - * - * @package model.om - */ abstract class BaseRelRolPermiso extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelRolPermisoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_rol_id field. - * @var int - */ + protected $fk_rol_id = 0; - /** - * The value for the fk_permiso_id field. - * @var int - */ + protected $fk_permiso_id = 0; - /** - * @var Rol - */ + protected $aRol; - /** - * @var Permiso - */ + protected $aPermiso; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_rol_id] column value. - * - * @return int - */ + public function getFkRolId() { return $this->fk_rol_id; } - /** - * Get the [fk_permiso_id] column value. - * - * @return int - */ + public function getFkPermisoId() { return $this->fk_permiso_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -119,14 +61,8 @@ $this->modifiedColumns[] = RelRolPermisoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_rol_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkRolId($v) { @@ -139,14 +75,8 @@ $this->aRol = null; } - } // setFkRolId() - - /** - * Set the value of [fk_permiso_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPermisoId($v) { @@ -159,21 +89,8 @@ $this->aPermiso = null; } - } // setFkPermisoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -188,23 +105,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RelRolPermisoPeer::NUM_COLUMNS - RelRolPermisoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating RelRolPermiso object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -226,16 +133,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -257,29 +155,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aRol !== null) { if ($this->aRol->isModified()) { $affectedRows += $this->aRol->save($con); @@ -295,57 +178,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelRolPermisoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelRolPermisoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -358,16 +215,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -377,11 +225,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aRol !== null) { if (!$this->aRol->validate($columns)) { $failureMap = array_merge($failureMap, $this->aRol->getValidationFailures()); @@ -407,28 +251,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelRolPermisoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -444,19 +274,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelRolPermisoPeer::getFieldNames($keyType); @@ -468,30 +288,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelRolPermisoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -504,25 +308,9 @@ case 2: $this->setFkPermisoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelRolPermisoPeer::getFieldNames($keyType); @@ -532,11 +320,7 @@ if (array_key_exists($keys[2], $arr)) $this->setFkPermisoId($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelRolPermisoPeer::DATABASE_NAME); @@ -548,14 +332,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelRolPermisoPeer::DATABASE_NAME); @@ -565,36 +342,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelRolPermiso (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -605,40 +365,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelRolPermiso Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelRolPermisoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -647,13 +386,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Rol object. - * - * @param Rol $v - * @return void - * @throws PropelException - */ + public function setRol($v) { @@ -669,42 +402,21 @@ } - /** - * Get the associated Rol object - * - * @param Connection Optional Connection object. - * @return Rol The associated Rol object. - * @throws PropelException - */ + public function getRol($con = null) { - // include the related Peer class - include_once 'model/om/BaseRolPeer.php'; + include_once 'lib/model/om/BaseRolPeer.php'; if ($this->aRol === null && ($this->fk_rol_id !== null)) { $this->aRol = RolPeer::retrieveByPK($this->fk_rol_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = RolPeer::retrieveByPK($this->fk_rol_id, $con); - $obj->addRols($this); - */ + } return $this->aRol; } - /** - * Declares an association between this object and a Permiso object. - * - * @param Permiso $v - * @return void - * @throws PropelException - */ + public function setPermiso($v) { @@ -720,33 +432,18 @@ } - /** - * Get the associated Permiso object - * - * @param Connection Optional Connection object. - * @return Permiso The associated Permiso object. - * @throws PropelException - */ + public function getPermiso($con = null) { - // include the related Peer class - include_once 'model/om/BasePermisoPeer.php'; + include_once 'lib/model/om/BasePermisoPeer.php'; if ($this->aPermiso === null && ($this->fk_permiso_id !== null)) { $this->aPermiso = PermisoPeer::retrieveByPK($this->fk_permiso_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PermisoPeer::retrieveByPK($this->fk_permiso_id, $con); - $obj->addPermisos($this); - */ + } return $this->aPermiso; } -} // BaseRelRolPermiso +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermisoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermisoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelRolPermisoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelRolPermisoPeer::getOMClass() -include_once 'model/RelRolPermiso.php'; -/** - * Base static class for performing query and update operations on the 'rel_rol_permiso' table. - * - * - * - * @package model.om - */ abstract class BaseRelRolPermisoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_rol_permiso'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelRolPermiso'; + + const CLASS_DEFAULT = 'lib.model.RelRolPermiso'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_rol_permiso.ID'; - /** the column name for the FK_ROL_ID field */ + const FK_ROL_ID = 'rel_rol_permiso.FK_ROL_ID'; - /** the column name for the FK_PERMISO_ID field */ + const FK_PERMISO_ID = 'rel_rol_permiso.FK_PERMISO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkRolId', 'FkPermisoId', ), BasePeer::TYPE_COLNAME => array (RelRolPermisoPeer::ID, RelRolPermisoPeer::FK_ROL_ID, RelRolPermisoPeer::FK_PERMISO_ID, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkRolId' => 1, 'FkPermisoId' => 2, ), BasePeer::TYPE_COLNAME => array (RelRolPermisoPeer::ID => 0, RelRolPermisoPeer::FK_ROL_ID => 1, RelRolPermisoPeer::FK_PERMISO_ID => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelRolPermisoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelRolPermisoMapBuilder'); + include_once 'lib/model/map/RelRolPermisoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelRolPermisoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelRolPermisoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelRolPermisoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(rel_rol_permiso.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_rol_permiso.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelRolPermiso - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelRolPermisoPeer::populateObjects(RelRolPermisoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RelRolPermisoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelRolPermisoPeer::getOMClass(); + $cls = RelRolPermisoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -302,29 +183,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Rol table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinRol(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -335,35 +206,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Permiso table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPermiso(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -374,25 +234,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelRolPermiso objects pre-filled with their Rol objects. - * - * @return array Array of RelRolPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinRol(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -420,37 +272,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getRol(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRol(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelRolPermiso($obj1); //CHECKME - break; + $temp_obj2->addRelRolPermiso($obj1); break; } } if ($newObject) { $obj2->initRelRolPermisos(); - $obj2->addRelRolPermiso($obj1); //CHECKME - } + $obj2->addRelRolPermiso($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelRolPermiso objects pre-filled with their Permiso objects. - * - * @return array Array of RelRolPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPermiso(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -478,46 +319,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPermiso(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPermiso(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelRolPermiso($obj1); //CHECKME - break; + $temp_obj2->addRelRolPermiso($obj1); break; } } if ($newObject) { $obj2->initRelRolPermisos(); - $obj2->addRelRolPermiso($obj1); //CHECKME - } + $obj2->addRelRolPermiso($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -530,25 +358,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelRolPermiso objects pre-filled with all related objects. - * - * @return array Array of RelRolPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -578,8 +398,7 @@ $obj1->hydrate($rs); - // Add objects for joined Rol rows - + $omClass = RolPeer::getOMClass(); @@ -590,11 +409,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getRol(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRol(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelRolPermiso($obj1); // CHECKME - break; + $temp_obj2->addRelRolPermiso($obj1); break; } } @@ -604,8 +421,7 @@ } - // Add objects for joined Permiso rows - + $omClass = PermisoPeer::getOMClass(); @@ -616,11 +432,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getPermiso(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getPermiso(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelRolPermiso($obj1); // CHECKME - break; + $temp_obj3->addRelRolPermiso($obj1); break; } } @@ -635,29 +449,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Rol table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptRol(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -668,35 +472,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Permiso table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptPermiso(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelRolPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -707,27 +500,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelRolPermiso objects pre-filled with all related objects except Rol. - * - * @return array Array of RelRolPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptRol(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -761,8 +544,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getPermiso(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPermiso(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelRolPermiso($obj1); break; @@ -780,21 +562,12 @@ } - /** - * Selects a collection of RelRolPermiso objects pre-filled with all related objects except Permiso. - * - * @return array Array of RelRolPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptPermiso(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -828,8 +601,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getRol(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getRol(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelRolPermiso($obj1); break; @@ -846,41 +618,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelRolPermisoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelRolPermiso or Criteria object. - * - * @param mixed $values Criteria or RelRolPermiso object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -888,21 +638,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelRolPermiso object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelRolPermisoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelRolPermisoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -913,15 +657,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelRolPermiso or Criteria object. - * - * @param mixed $values Criteria or RelRolPermiso object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -931,37 +667,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelRolPermisoPeer::ID); $selectCriteria->add(RelRolPermisoPeer::ID, $criteria->remove(RelRolPermisoPeer::ID), $comparison); - } else { // $values is RelRolPermiso object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_rol_permiso table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelRolPermisoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -971,17 +695,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelRolPermiso or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelRolPermiso object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -989,25 +703,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelRolPermiso) { + $criteria = clone $values; } elseif ($values instanceof RelRolPermiso) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelRolPermisoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1018,18 +726,7 @@ } } - /** - * Validates all modified columns of given RelRolPermiso object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelRolPermiso $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelRolPermiso $obj, $cols = null) { $columns = array(); @@ -1064,13 +761,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelRolPermiso - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1087,14 +778,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1112,20 +796,14 @@ return $objs; } -} // BaseRelRolPermisoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelRolPermisoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelRolPermisoMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelRolPermisoMapBuilder'); + require_once 'lib/model/map/RelRolPermisoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelRolPermisoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermiso.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermiso.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermiso.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,116 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelUsuarioPermisoPeer.php'; - -/** - * Base class that represents a row from the 'rel_usuario_permiso' table. - * - * - * - * @package model.om - */ abstract class BaseRelUsuarioPermiso extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelUsuarioPermisoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_usuario_id field. - * @var int - */ + protected $fk_usuario_id = 0; - /** - * The value for the fk_permiso_id field. - * @var int - */ + protected $fk_permiso_id = 0; - /** - * @var Usuario - */ + protected $aUsuario; - /** - * @var Permiso - */ + protected $aPermiso; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_usuario_id] column value. - * - * @return int - */ + public function getFkUsuarioId() { return $this->fk_usuario_id; } - /** - * Get the [fk_permiso_id] column value. - * - * @return int - */ + public function getFkPermisoId() { return $this->fk_permiso_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -119,14 +61,8 @@ $this->modifiedColumns[] = RelUsuarioPermisoPeer::ID; } - } // setId() - - /** - * Set the value of [fk_usuario_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkUsuarioId($v) { @@ -139,14 +75,8 @@ $this->aUsuario = null; } - } // setFkUsuarioId() - - /** - * Set the value of [fk_permiso_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPermisoId($v) { @@ -159,21 +89,8 @@ $this->aPermiso = null; } - } // setFkPermisoId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -188,23 +105,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RelUsuarioPermisoPeer::NUM_COLUMNS - RelUsuarioPermisoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating RelUsuarioPermiso object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -226,16 +133,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -257,29 +155,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aUsuario !== null) { if ($this->aUsuario->isModified()) { $affectedRows += $this->aUsuario->save($con); @@ -295,57 +178,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelUsuarioPermisoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelUsuarioPermisoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -358,16 +215,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -377,11 +225,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aUsuario !== null) { if (!$this->aUsuario->validate($columns)) { $failureMap = array_merge($failureMap, $this->aUsuario->getValidationFailures()); @@ -407,28 +251,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelUsuarioPermisoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -444,19 +274,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelUsuarioPermisoPeer::getFieldNames($keyType); @@ -468,30 +288,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelUsuarioPermisoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -504,25 +308,9 @@ case 2: $this->setFkPermisoId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelUsuarioPermisoPeer::getFieldNames($keyType); @@ -532,11 +320,7 @@ if (array_key_exists($keys[2], $arr)) $this->setFkPermisoId($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelUsuarioPermisoPeer::DATABASE_NAME); @@ -548,14 +332,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelUsuarioPermisoPeer::DATABASE_NAME); @@ -565,36 +342,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelUsuarioPermiso (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -605,40 +365,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelUsuarioPermiso Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelUsuarioPermisoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -647,13 +386,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Usuario object. - * - * @param Usuario $v - * @return void - * @throws PropelException - */ + public function setUsuario($v) { @@ -669,42 +402,21 @@ } - /** - * Get the associated Usuario object - * - * @param Connection Optional Connection object. - * @return Usuario The associated Usuario object. - * @throws PropelException - */ + public function getUsuario($con = null) { - // include the related Peer class - include_once 'model/om/BaseUsuarioPeer.php'; + include_once 'lib/model/om/BaseUsuarioPeer.php'; if ($this->aUsuario === null && ($this->fk_usuario_id !== null)) { $this->aUsuario = UsuarioPeer::retrieveByPK($this->fk_usuario_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = UsuarioPeer::retrieveByPK($this->fk_usuario_id, $con); - $obj->addUsuarios($this); - */ + } return $this->aUsuario; } - /** - * Declares an association between this object and a Permiso object. - * - * @param Permiso $v - * @return void - * @throws PropelException - */ + public function setPermiso($v) { @@ -720,33 +432,18 @@ } - /** - * Get the associated Permiso object - * - * @param Connection Optional Connection object. - * @return Permiso The associated Permiso object. - * @throws PropelException - */ + public function getPermiso($con = null) { - // include the related Peer class - include_once 'model/om/BasePermisoPeer.php'; + include_once 'lib/model/om/BasePermisoPeer.php'; if ($this->aPermiso === null && ($this->fk_permiso_id !== null)) { $this->aPermiso = PermisoPeer::retrieveByPK($this->fk_permiso_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = PermisoPeer::retrieveByPK($this->fk_permiso_id, $con); - $obj->addPermisos($this); - */ + } return $this->aPermiso; } -} // BaseRelUsuarioPermiso +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermisoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermisoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPermisoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelUsuarioPermisoPeer::getOMClass() -include_once 'model/RelUsuarioPermiso.php'; -/** - * Base static class for performing query and update operations on the 'rel_usuario_permiso' table. - * - * - * - * @package model.om - */ abstract class BaseRelUsuarioPermisoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_usuario_permiso'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelUsuarioPermiso'; + + const CLASS_DEFAULT = 'lib.model.RelUsuarioPermiso'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_usuario_permiso.ID'; - /** the column name for the FK_USUARIO_ID field */ + const FK_USUARIO_ID = 'rel_usuario_permiso.FK_USUARIO_ID'; - /** the column name for the FK_PERMISO_ID field */ + const FK_PERMISO_ID = 'rel_usuario_permiso.FK_PERMISO_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkUsuarioId', 'FkPermisoId', ), BasePeer::TYPE_COLNAME => array (RelUsuarioPermisoPeer::ID, RelUsuarioPermisoPeer::FK_USUARIO_ID, RelUsuarioPermisoPeer::FK_PERMISO_ID, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkUsuarioId' => 1, 'FkPermisoId' => 2, ), BasePeer::TYPE_COLNAME => array (RelUsuarioPermisoPeer::ID => 0, RelUsuarioPermisoPeer::FK_USUARIO_ID => 1, RelUsuarioPermisoPeer::FK_PERMISO_ID => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelUsuarioPermisoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelUsuarioPermisoMapBuilder'); + include_once 'lib/model/map/RelUsuarioPermisoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelUsuarioPermisoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelUsuarioPermisoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelUsuarioPermisoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(rel_usuario_permiso.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_usuario_permiso.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelUsuarioPermiso - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelUsuarioPermisoPeer::populateObjects(RelUsuarioPermisoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RelUsuarioPermisoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelUsuarioPermisoPeer::getOMClass(); + $cls = RelUsuarioPermisoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -302,29 +183,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Usuario table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinUsuario(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -335,35 +206,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Permiso table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinPermiso(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -374,25 +234,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelUsuarioPermiso objects pre-filled with their Usuario objects. - * - * @return array Array of RelUsuarioPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinUsuario(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -420,37 +272,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getUsuario(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getUsuario(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelUsuarioPermiso($obj1); //CHECKME - break; + $temp_obj2->addRelUsuarioPermiso($obj1); break; } } if ($newObject) { $obj2->initRelUsuarioPermisos(); - $obj2->addRelUsuarioPermiso($obj1); //CHECKME - } + $obj2->addRelUsuarioPermiso($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of RelUsuarioPermiso objects pre-filled with their Permiso objects. - * - * @return array Array of RelUsuarioPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinPermiso(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -478,46 +319,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getPermiso(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPermiso(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addRelUsuarioPermiso($obj1); //CHECKME - break; + $temp_obj2->addRelUsuarioPermiso($obj1); break; } } if ($newObject) { $obj2->initRelUsuarioPermisos(); - $obj2->addRelUsuarioPermiso($obj1); //CHECKME - } + $obj2->addRelUsuarioPermiso($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -530,25 +358,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelUsuarioPermiso objects pre-filled with all related objects. - * - * @return array Array of RelUsuarioPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -578,8 +398,7 @@ $obj1->hydrate($rs); - // Add objects for joined Usuario rows - + $omClass = UsuarioPeer::getOMClass(); @@ -590,11 +409,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getUsuario(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getUsuario(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addRelUsuarioPermiso($obj1); // CHECKME - break; + $temp_obj2->addRelUsuarioPermiso($obj1); break; } } @@ -604,8 +421,7 @@ } - // Add objects for joined Permiso rows - + $omClass = PermisoPeer::getOMClass(); @@ -616,11 +432,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getPermiso(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getPermiso(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addRelUsuarioPermiso($obj1); // CHECKME - break; + $temp_obj3->addRelUsuarioPermiso($obj1); break; } } @@ -635,29 +449,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Usuario table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptUsuario(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -668,35 +472,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Permiso table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptPermiso(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPermisoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -707,27 +500,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of RelUsuarioPermiso objects pre-filled with all related objects except Usuario. - * - * @return array Array of RelUsuarioPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptUsuario(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -761,8 +544,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getPermiso(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getPermiso(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelUsuarioPermiso($obj1); break; @@ -780,21 +562,12 @@ } - /** - * Selects a collection of RelUsuarioPermiso objects pre-filled with all related objects except Permiso. - * - * @return array Array of RelUsuarioPermiso objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptPermiso(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -828,8 +601,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getUsuario(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getUsuario(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addRelUsuarioPermiso($obj1); break; @@ -846,41 +618,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelUsuarioPermisoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelUsuarioPermiso or Criteria object. - * - * @param mixed $values Criteria or RelUsuarioPermiso object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -888,21 +638,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelUsuarioPermiso object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelUsuarioPermisoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelUsuarioPermisoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -913,15 +657,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelUsuarioPermiso or Criteria object. - * - * @param mixed $values Criteria or RelUsuarioPermiso object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -931,37 +667,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelUsuarioPermisoPeer::ID); $selectCriteria->add(RelUsuarioPermisoPeer::ID, $criteria->remove(RelUsuarioPermisoPeer::ID), $comparison); - } else { // $values is RelUsuarioPermiso object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_usuario_permiso table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelUsuarioPermisoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -971,17 +695,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelUsuarioPermiso or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelUsuarioPermiso object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -989,25 +703,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelUsuarioPermiso) { + $criteria = clone $values; } elseif ($values instanceof RelUsuarioPermiso) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelUsuarioPermisoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1018,18 +726,7 @@ } } - /** - * Validates all modified columns of given RelUsuarioPermiso object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelUsuarioPermiso $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelUsuarioPermiso $obj, $cols = null) { $columns = array(); @@ -1064,13 +761,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelUsuarioPermiso - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1087,14 +778,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1112,20 +796,14 @@ return $objs; } -} // BaseRelUsuarioPermisoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelUsuarioPermisoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelUsuarioPermisoMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelUsuarioPermisoMapBuilder'); + require_once 'lib/model/map/RelUsuarioPermisoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelUsuarioPermisoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,106 +1,52 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RelUsuarioPreferenciaPeer.php'; - -/** - * Base class that represents a row from the 'rel_usuario_preferencia' table. - * - * - * - * @package model.om - */ abstract class BaseRelUsuarioPreferencia extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RelUsuarioPreferenciaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_usuario_id field. - * @var int - */ + protected $fk_usuario_id = 0; - /** - * The value for the fk_preferencia_id field. - * @var int - */ + protected $fk_preferencia_id = 0; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_usuario_id] column value. - * - * @return int - */ + public function getFkUsuarioId() { return $this->fk_usuario_id; } - /** - * Get the [fk_preferencia_id] column value. - * - * @return int - */ + public function getFkPreferenciaId() { return $this->fk_preferencia_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -109,14 +55,8 @@ $this->modifiedColumns[] = RelUsuarioPreferenciaPeer::ID; } - } // setId() - - /** - * Set the value of [fk_usuario_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkUsuarioId($v) { @@ -125,14 +65,8 @@ $this->modifiedColumns[] = RelUsuarioPreferenciaPeer::FK_USUARIO_ID; } - } // setFkUsuarioId() - - /** - * Set the value of [fk_preferencia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkPreferenciaId($v) { @@ -141,21 +75,8 @@ $this->modifiedColumns[] = RelUsuarioPreferenciaPeer::FK_PREFERENCIA_ID; } - } // setFkPreferenciaId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -170,23 +91,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RelUsuarioPreferenciaPeer::NUM_COLUMNS - RelUsuarioPreferenciaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating RelUsuarioPreferencia object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -208,16 +119,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -239,75 +141,38 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RelUsuarioPreferenciaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RelUsuarioPreferenciaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -320,16 +185,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -351,28 +207,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RelUsuarioPreferenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -388,19 +230,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RelUsuarioPreferenciaPeer::getFieldNames($keyType); @@ -412,30 +244,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RelUsuarioPreferenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -448,25 +264,9 @@ case 2: $this->setFkPreferenciaId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RelUsuarioPreferenciaPeer::getFieldNames($keyType); @@ -476,11 +276,7 @@ if (array_key_exists($keys[2], $arr)) $this->setFkPreferenciaId($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RelUsuarioPreferenciaPeer::DATABASE_NAME); @@ -492,14 +288,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RelUsuarioPreferenciaPeer::DATABASE_NAME); @@ -509,36 +298,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of RelUsuarioPreferencia (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -549,40 +321,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return RelUsuarioPreferencia Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RelUsuarioPreferenciaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -591,4 +342,4 @@ return self::$peer; } -} // BaseRelUsuarioPreferencia +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRelUsuarioPreferenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RelUsuarioPreferenciaPeer::getOMClass() -include_once 'model/RelUsuarioPreferencia.php'; -/** - * Base static class for performing query and update operations on the 'rel_usuario_preferencia' table. - * - * - * - * @package model.om - */ abstract class BaseRelUsuarioPreferenciaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rel_usuario_preferencia'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.RelUsuarioPreferencia'; + + const CLASS_DEFAULT = 'lib.model.RelUsuarioPreferencia'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rel_usuario_preferencia.ID'; - /** the column name for the FK_USUARIO_ID field */ + const FK_USUARIO_ID = 'rel_usuario_preferencia.FK_USUARIO_ID'; - /** the column name for the FK_PREFERENCIA_ID field */ + const FK_PREFERENCIA_ID = 'rel_usuario_preferencia.FK_PREFERENCIA_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkUsuarioId', 'FkPreferenciaId', ), BasePeer::TYPE_COLNAME => array (RelUsuarioPreferenciaPeer::ID, RelUsuarioPreferenciaPeer::FK_USUARIO_ID, RelUsuarioPreferenciaPeer::FK_PREFERENCIA_ID, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkUsuarioId' => 1, 'FkPreferenciaId' => 2, ), BasePeer::TYPE_COLNAME => array (RelUsuarioPreferenciaPeer::ID => 0, RelUsuarioPreferenciaPeer::FK_USUARIO_ID => 1, RelUsuarioPreferenciaPeer::FK_PREFERENCIA_ID => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RelUsuarioPreferenciaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RelUsuarioPreferenciaMapBuilder'); + include_once 'lib/model/map/RelUsuarioPreferenciaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RelUsuarioPreferenciaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RelUsuarioPreferenciaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RelUsuarioPreferenciaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(rel_usuario_preferencia.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rel_usuario_preferencia.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RelUsuarioPreferenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RelUsuarioPreferenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return RelUsuarioPreferencia - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RelUsuarioPreferenciaPeer::populateObjects(RelUsuarioPreferenciaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RelUsuarioPreferenciaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RelUsuarioPreferenciaPeer::getOMClass(); + $cls = RelUsuarioPreferenciaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RelUsuarioPreferenciaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a RelUsuarioPreferencia or Criteria object. - * - * @param mixed $values Criteria or RelUsuarioPreferencia object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from RelUsuarioPreferencia object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RelUsuarioPreferenciaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RelUsuarioPreferenciaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a RelUsuarioPreferencia or Criteria object. - * - * @param mixed $values Criteria or RelUsuarioPreferencia object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RelUsuarioPreferenciaPeer::ID); $selectCriteria->add(RelUsuarioPreferenciaPeer::ID, $criteria->remove(RelUsuarioPreferenciaPeer::ID), $comparison); - } else { // $values is RelUsuarioPreferencia object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rel_usuario_preferencia table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RelUsuarioPreferenciaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a RelUsuarioPreferencia or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or RelUsuarioPreferencia object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof RelUsuarioPreferencia) { + $criteria = clone $values; } elseif ($values instanceof RelUsuarioPreferencia) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RelUsuarioPreferenciaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given RelUsuarioPreferencia object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param RelUsuarioPreferencia $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(RelUsuarioPreferencia $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return RelUsuarioPreferencia - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseRelUsuarioPreferenciaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRelUsuarioPreferenciaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RelUsuarioPreferenciaMapBuilder.php'; - Propel::registerMapBuilder('model.map.RelUsuarioPreferenciaMapBuilder'); + require_once 'lib/model/map/RelUsuarioPreferenciaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RelUsuarioPreferenciaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,130 +1,64 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RepeticionPeer.php'; - -/** - * Base class that represents a row from the 'repeticion' table. - * - * - * - * @package model.om - */ abstract class BaseRepeticion extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RepeticionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * The value for the orden field. - * @var int - */ + protected $orden = 0; - /** - * Collection to store aggregation of collRelDivisionActividadDocentes. - * @var array - */ + protected $collRelDivisionActividadDocentes; - /** - * The criteria used to select the current contents of collRelDivisionActividadDocentes. - * @var Criteria - */ + protected $lastRelDivisionActividadDocenteCriteria = null; - /** - * Collection to store aggregation of collDocenteHorarios. - * @var array - */ + protected $collDocenteHorarios; - /** - * The criteria used to select the current contents of collDocenteHorarios. - * @var Criteria - */ + protected $lastDocenteHorarioCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [orden] column value. - * - * @return int - */ + public function getOrden() { return $this->orden; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -133,14 +67,8 @@ $this->modifiedColumns[] = RepeticionPeer::ID; } - } // setId() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -149,14 +77,8 @@ $this->modifiedColumns[] = RepeticionPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [orden] column. - * - * @param int $v new value - * @return void - */ + } + public function setOrden($v) { @@ -165,21 +87,8 @@ $this->modifiedColumns[] = RepeticionPeer::ORDEN; } - } // setOrden() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -194,23 +103,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = RepeticionPeer::NUM_COLUMNS - RepeticionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Repeticion object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -232,16 +131,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -263,40 +153,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RepeticionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RepeticionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelDivisionActividadDocentes !== null) { foreach($this->collRelDivisionActividadDocentes as $referrerFK) { @@ -317,37 +190,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -360,16 +213,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -407,28 +251,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RepeticionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -444,19 +274,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RepeticionPeer::getFieldNames($keyType); @@ -468,30 +288,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RepeticionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -504,25 +308,9 @@ case 2: $this->setOrden($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RepeticionPeer::getFieldNames($keyType); @@ -532,11 +320,7 @@ if (array_key_exists($keys[2], $arr)) $this->setOrden($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RepeticionPeer::DATABASE_NAME); @@ -548,14 +332,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RepeticionPeer::DATABASE_NAME); @@ -565,36 +342,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Repeticion (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -604,9 +364,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelDivisionActividadDocentes() as $relObj) { $copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy)); @@ -616,45 +374,23 @@ $copyObj->addDocenteHorario($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Repeticion Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RepeticionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -663,12 +399,7 @@ return self::$peer; } - /** - * Temporary storage of collRelDivisionActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDivisionActividadDocentes() { if ($this->collRelDivisionActividadDocentes === null) { @@ -676,23 +407,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * If this Repeticion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDivisionActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -712,13 +430,9 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDivisionActividadDocentePeer::FK_REPETICION_ID, $this->getId()); RelDivisionActividadDocentePeer::addSelectColumns($criteria); @@ -731,18 +445,10 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Returns the number of related RelDivisionActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDivisionActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -756,14 +462,7 @@ return RelDivisionActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDivisionActividadDocente object to this object - * through the RelDivisionActividadDocente foreign key attribute - * - * @param RelDivisionActividadDocente $l RelDivisionActividadDocente - * @return void - * @throws PropelException - */ + public function addRelDivisionActividadDocente(RelDivisionActividadDocente $l) { $this->collRelDivisionActividadDocentes[] = $l; @@ -771,21 +470,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion is new, it will return - * an empty collection; or if this Repeticion has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Repeticion. - */ + public function getRelDivisionActividadDocentesJoinDivision($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -804,10 +492,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDivision($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_REPETICION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -820,21 +505,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion is new, it will return - * an empty collection; or if this Repeticion has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Repeticion. - */ + public function getRelDivisionActividadDocentesJoinTipodocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -853,10 +527,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinTipodocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_REPETICION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -869,21 +540,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion is new, it will return - * an empty collection; or if this Repeticion has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Repeticion. - */ + public function getRelDivisionActividadDocentesJoinCargobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -902,10 +562,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinCargobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_REPETICION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -918,21 +575,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion is new, it will return - * an empty collection; or if this Repeticion has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Repeticion. - */ + public function getRelDivisionActividadDocentesJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -951,10 +597,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_REPETICION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -967,21 +610,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion is new, it will return - * an empty collection; or if this Repeticion has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Repeticion. - */ + public function getRelDivisionActividadDocentesJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1000,10 +632,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_REPETICION_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -1015,12 +644,7 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Temporary storage of collDocenteHorarios to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initDocenteHorarios() { if ($this->collDocenteHorarios === null) { @@ -1028,23 +652,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion has previously - * been saved, it will retrieve related DocenteHorarios from storage. - * If this Repeticion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getDocenteHorarios($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocenteHorarioPeer.php'; + include_once 'lib/model/om/BaseDocenteHorarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1064,13 +675,9 @@ $this->collDocenteHorarios = DocenteHorarioPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId()); DocenteHorarioPeer::addSelectColumns($criteria); @@ -1083,18 +690,10 @@ return $this->collDocenteHorarios; } - /** - * Returns the number of related DocenteHorarios. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countDocenteHorarios($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocenteHorarioPeer.php'; + include_once 'lib/model/om/BaseDocenteHorarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1108,14 +707,7 @@ return DocenteHorarioPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a DocenteHorario object to this object - * through the DocenteHorario foreign key attribute - * - * @param DocenteHorario $l DocenteHorario - * @return void - * @throws PropelException - */ + public function addDocenteHorario(DocenteHorario $l) { $this->collDocenteHorarios[] = $l; @@ -1123,21 +715,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Repeticion is new, it will return - * an empty collection; or if this Repeticion has previously - * been saved, it will retrieve related DocenteHorarios from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Repeticion. - */ + public function getDocenteHorariosJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocenteHorarioPeer.php'; + include_once 'lib/model/om/BaseDocenteHorarioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1156,10 +737,7 @@ $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId()); if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) { @@ -1171,4 +749,4 @@ return $this->collDocenteHorarios; } -} // BaseRepeticion +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRepeticionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRepeticionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRepeticionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RepeticionPeer::getOMClass() -include_once 'model/Repeticion.php'; -/** - * Base static class for performing query and update operations on the 'repeticion' table. - * - * - * - * @package model.om - */ abstract class BaseRepeticionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'repeticion'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Repeticion'; + + const CLASS_DEFAULT = 'lib.model.Repeticion'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'repeticion.ID'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'repeticion.DESCRIPCION'; - /** the column name for the ORDEN field */ + const ORDEN = 'repeticion.ORDEN'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Descripcion', 'Orden', ), BasePeer::TYPE_COLNAME => array (RepeticionPeer::ID, RepeticionPeer::DESCRIPCION, RepeticionPeer::ORDEN, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Descripcion' => 1, 'Orden' => 2, ), BasePeer::TYPE_COLNAME => array (RepeticionPeer::ID => 0, RepeticionPeer::DESCRIPCION => 1, RepeticionPeer::ORDEN => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RepeticionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RepeticionMapBuilder'); + include_once 'lib/model/map/RepeticionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RepeticionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RepeticionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RepeticionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(repeticion.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT repeticion.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RepeticionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RepeticionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Repeticion - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RepeticionPeer::populateObjects(RepeticionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ RepeticionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RepeticionPeer::getOMClass(); + $cls = RepeticionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RepeticionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Repeticion or Criteria object. - * - * @param mixed $values Criteria or Repeticion object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Repeticion object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RepeticionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RepeticionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Repeticion or Criteria object. - * - * @param mixed $values Criteria or Repeticion object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RepeticionPeer::ID); $selectCriteria->add(RepeticionPeer::ID, $criteria->remove(RepeticionPeer::ID), $comparison); - } else { // $values is Repeticion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the repeticion table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RepeticionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Repeticion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Repeticion object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Repeticion) { + $criteria = clone $values; } elseif ($values instanceof Repeticion) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RepeticionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Repeticion object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Repeticion $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Repeticion $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Repeticion - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseRepeticionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRepeticionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RepeticionMapBuilder.php'; - Propel::registerMapBuilder('model.map.RepeticionMapBuilder'); + require_once 'lib/model/map/RepeticionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RepeticionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseResponsable.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseResponsable.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseResponsable.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,373 +1,215 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/ResponsablePeer.php'; - -/** - * Base class that represents a row from the 'responsable' table. - * - * - * - * @package model.om - */ abstract class BaseResponsable extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var ResponsablePeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the apellido field. - * @var string - */ + protected $apellido = ''; - /** - * The value for the direccion field. - * @var string - */ + protected $direccion = ''; - /** - * The value for the ciudad field. - * @var string - */ + protected $ciudad = ''; - /** - * The value for the codigo_postal field. - * @var string - */ + protected $codigo_postal = ''; - /** - * The value for the fk_provincia_id field. - * @var int - */ + protected $fk_provincia_id = 0; - /** - * The value for the telefono field. - * @var string - */ + protected $telefono = ''; - /** - * The value for the telefono_movil field. - * @var string - */ + protected $telefono_movil = ''; - /** - * The value for the nro_documento field. - * @var string - */ + protected $nro_documento = ''; - /** - * The value for the fk_tipodocumento_id field. - * @var int - */ + protected $fk_tipodocumento_id = 0; - /** - * The value for the sexo field. - * @var string - */ + protected $sexo = ''; - /** - * The value for the email field. - * @var string - */ + protected $email = ''; - /** - * The value for the relacion field. - * @var string - */ + protected $relacion = ''; - /** - * The value for the observacion field. - * @var string - */ + protected $observacion = ''; - /** - * The value for the autorizacion_retiro field. - * @var boolean - */ + protected $autorizacion_retiro = true; - /** - * The value for the fk_cuenta_id field. - * @var int - */ + protected $fk_cuenta_id = 0; - /** - * @var Cuenta - */ + protected $aCuenta; - /** - * @var Provincia - */ + protected $aProvincia; - /** - * @var Tipodocumento - */ + protected $aTipodocumento; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [apellido] column value. - * - * @return string - */ + public function getApellido() { return $this->apellido; } - /** - * Get the [direccion] column value. - * - * @return string - */ + public function getDireccion() { return $this->direccion; } - /** - * Get the [ciudad] column value. - * - * @return string - */ + public function getCiudad() { return $this->ciudad; } - /** - * Get the [codigo_postal] column value. - * - * @return string - */ + public function getCodigoPostal() { return $this->codigo_postal; } - /** - * Get the [fk_provincia_id] column value. - * - * @return int - */ + public function getFkProvinciaId() { return $this->fk_provincia_id; } - /** - * Get the [telefono] column value. - * - * @return string - */ + public function getTelefono() { return $this->telefono; } - /** - * Get the [telefono_movil] column value. - * - * @return string - */ + public function getTelefonoMovil() { return $this->telefono_movil; } - /** - * Get the [nro_documento] column value. - * - * @return string - */ + public function getNroDocumento() { return $this->nro_documento; } - /** - * Get the [fk_tipodocumento_id] column value. - * - * @return int - */ + public function getFkTipodocumentoId() { return $this->fk_tipodocumento_id; } - /** - * Get the [sexo] column value. - * - * @return string - */ + public function getSexo() { return $this->sexo; } - /** - * Get the [email] column value. - * - * @return string - */ + public function getEmail() { return $this->email; } - /** - * Get the [relacion] column value. - * - * @return string - */ + public function getRelacion() { return $this->relacion; } - /** - * Get the [observacion] column value. - * - * @return string - */ + public function getObservacion() { return $this->observacion; } - /** - * Get the [autorizacion_retiro] column value. - * - * @return boolean - */ + public function getAutorizacionRetiro() { return $this->autorizacion_retiro; } - /** - * Get the [fk_cuenta_id] column value. - * - * @return int - */ + public function getFkCuentaId() { return $this->fk_cuenta_id; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -376,14 +218,8 @@ $this->modifiedColumns[] = ResponsablePeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -392,14 +228,8 @@ $this->modifiedColumns[] = ResponsablePeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [apellido] column. - * - * @param string $v new value - * @return void - */ + } + public function setApellido($v) { @@ -408,14 +238,8 @@ $this->modifiedColumns[] = ResponsablePeer::APELLIDO; } - } // setApellido() - - /** - * Set the value of [direccion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDireccion($v) { @@ -424,14 +248,8 @@ $this->modifiedColumns[] = ResponsablePeer::DIRECCION; } - } // setDireccion() - - /** - * Set the value of [ciudad] column. - * - * @param string $v new value - * @return void - */ + } + public function setCiudad($v) { @@ -440,14 +258,8 @@ $this->modifiedColumns[] = ResponsablePeer::CIUDAD; } - } // setCiudad() - - /** - * Set the value of [codigo_postal] column. - * - * @param string $v new value - * @return void - */ + } + public function setCodigoPostal($v) { @@ -456,14 +268,8 @@ $this->modifiedColumns[] = ResponsablePeer::CODIGO_POSTAL; } - } // setCodigoPostal() - - /** - * Set the value of [fk_provincia_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkProvinciaId($v) { @@ -476,14 +282,8 @@ $this->aProvincia = null; } - } // setFkProvinciaId() - - /** - * Set the value of [telefono] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefono($v) { @@ -492,14 +292,8 @@ $this->modifiedColumns[] = ResponsablePeer::TELEFONO; } - } // setTelefono() - - /** - * Set the value of [telefono_movil] column. - * - * @param string $v new value - * @return void - */ + } + public function setTelefonoMovil($v) { @@ -508,14 +302,8 @@ $this->modifiedColumns[] = ResponsablePeer::TELEFONO_MOVIL; } - } // setTelefonoMovil() - - /** - * Set the value of [nro_documento] column. - * - * @param string $v new value - * @return void - */ + } + public function setNroDocumento($v) { @@ -524,14 +312,8 @@ $this->modifiedColumns[] = ResponsablePeer::NRO_DOCUMENTO; } - } // setNroDocumento() - - /** - * Set the value of [fk_tipodocumento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkTipodocumentoId($v) { @@ -544,14 +326,8 @@ $this->aTipodocumento = null; } - } // setFkTipodocumentoId() - - /** - * Set the value of [sexo] column. - * - * @param string $v new value - * @return void - */ + } + public function setSexo($v) { @@ -560,14 +336,8 @@ $this->modifiedColumns[] = ResponsablePeer::SEXO; } - } // setSexo() - - /** - * Set the value of [email] column. - * - * @param string $v new value - * @return void - */ + } + public function setEmail($v) { @@ -576,14 +346,8 @@ $this->modifiedColumns[] = ResponsablePeer::EMAIL; } - } // setEmail() - - /** - * Set the value of [relacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setRelacion($v) { @@ -592,14 +356,8 @@ $this->modifiedColumns[] = ResponsablePeer::RELACION; } - } // setRelacion() - - /** - * Set the value of [observacion] column. - * - * @param string $v new value - * @return void - */ + } + public function setObservacion($v) { @@ -608,14 +366,8 @@ $this->modifiedColumns[] = ResponsablePeer::OBSERVACION; } - } // setObservacion() - - /** - * Set the value of [autorizacion_retiro] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setAutorizacionRetiro($v) { @@ -624,14 +376,8 @@ $this->modifiedColumns[] = ResponsablePeer::AUTORIZACION_RETIRO; } - } // setAutorizacionRetiro() - - /** - * Set the value of [fk_cuenta_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCuentaId($v) { @@ -644,21 +390,8 @@ $this->aCuenta = null; } - } // setFkCuentaId() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -701,23 +434,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 17; // 17 = ResponsablePeer::NUM_COLUMNS - ResponsablePeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 17; } catch (Exception $e) { throw new PropelException("Error populating Responsable object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -739,16 +462,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -770,29 +484,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCuenta !== null) { if ($this->aCuenta->isModified()) { $affectedRows += $this->aCuenta->save($con); @@ -815,57 +514,31 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = ResponsablePeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += ResponsablePeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -878,16 +551,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -897,11 +561,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCuenta !== null) { if (!$this->aCuenta->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCuenta->getValidationFailures()); @@ -933,28 +593,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = ResponsablePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -1012,19 +658,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = ResponsablePeer::getFieldNames($keyType); @@ -1050,30 +686,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = ResponsablePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -1128,25 +748,9 @@ case 16: $this->setFkCuentaId($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ResponsablePeer::getFieldNames($keyType); @@ -1170,11 +774,7 @@ if (array_key_exists($keys[16], $arr)) $this->setFkCuentaId($arr[$keys[16]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(ResponsablePeer::DATABASE_NAME); @@ -1200,14 +800,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(ResponsablePeer::DATABASE_NAME); @@ -1217,36 +810,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Responsable (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1285,40 +861,19 @@ $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Responsable Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ResponsablePeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1327,13 +882,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Cuenta object. - * - * @param Cuenta $v - * @return void - * @throws PropelException - */ + public function setCuenta($v) { @@ -1349,42 +898,21 @@ } - /** - * Get the associated Cuenta object - * - * @param Connection Optional Connection object. - * @return Cuenta The associated Cuenta object. - * @throws PropelException - */ + public function getCuenta($con = null) { - // include the related Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($this->aCuenta === null && ($this->fk_cuenta_id !== null)) { $this->aCuenta = CuentaPeer::retrieveByPK($this->fk_cuenta_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CuentaPeer::retrieveByPK($this->fk_cuenta_id, $con); - $obj->addCuentas($this); - */ + } return $this->aCuenta; } - /** - * Declares an association between this object and a Provincia object. - * - * @param Provincia $v - * @return void - * @throws PropelException - */ + public function setProvincia($v) { @@ -1400,42 +928,21 @@ } - /** - * Get the associated Provincia object - * - * @param Connection Optional Connection object. - * @return Provincia The associated Provincia object. - * @throws PropelException - */ + public function getProvincia($con = null) { - // include the related Peer class - include_once 'model/om/BaseProvinciaPeer.php'; + include_once 'lib/model/om/BaseProvinciaPeer.php'; if ($this->aProvincia === null && ($this->fk_provincia_id !== null)) { $this->aProvincia = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = ProvinciaPeer::retrieveByPK($this->fk_provincia_id, $con); - $obj->addProvincias($this); - */ + } return $this->aProvincia; } - /** - * Declares an association between this object and a Tipodocumento object. - * - * @param Tipodocumento $v - * @return void - * @throws PropelException - */ + public function setTipodocumento($v) { @@ -1451,33 +958,18 @@ } - /** - * Get the associated Tipodocumento object - * - * @param Connection Optional Connection object. - * @return Tipodocumento The associated Tipodocumento object. - * @throws PropelException - */ + public function getTipodocumento($con = null) { - // include the related Peer class - include_once 'model/om/BaseTipodocumentoPeer.php'; + include_once 'lib/model/om/BaseTipodocumentoPeer.php'; if ($this->aTipodocumento === null && ($this->fk_tipodocumento_id !== null)) { $this->aTipodocumento = TipodocumentoPeer::retrieveByPK($this->fk_tipodocumento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = TipodocumentoPeer::retrieveByPK($this->fk_tipodocumento_id, $con); - $obj->addTipodocumentos($this); - */ + } return $this->aTipodocumento; } -} // BaseResponsable +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseResponsablePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseResponsablePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseResponsablePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,96 +1,80 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ResponsablePeer::getOMClass() -include_once 'model/Responsable.php'; -/** - * Base static class for performing query and update operations on the 'responsable' table. - * - * - * - * @package model.om - */ abstract class BaseResponsablePeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'responsable'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Responsable'; + + const CLASS_DEFAULT = 'lib.model.Responsable'; - /** The total number of columns. */ + const NUM_COLUMNS = 17; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'responsable.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'responsable.NOMBRE'; - /** the column name for the APELLIDO field */ + const APELLIDO = 'responsable.APELLIDO'; - /** the column name for the DIRECCION field */ + const DIRECCION = 'responsable.DIRECCION'; - /** the column name for the CIUDAD field */ + const CIUDAD = 'responsable.CIUDAD'; - /** the column name for the CODIGO_POSTAL field */ + const CODIGO_POSTAL = 'responsable.CODIGO_POSTAL'; - /** the column name for the FK_PROVINCIA_ID field */ + const FK_PROVINCIA_ID = 'responsable.FK_PROVINCIA_ID'; - /** the column name for the TELEFONO field */ + const TELEFONO = 'responsable.TELEFONO'; - /** the column name for the TELEFONO_MOVIL field */ + const TELEFONO_MOVIL = 'responsable.TELEFONO_MOVIL'; - /** the column name for the NRO_DOCUMENTO field */ + const NRO_DOCUMENTO = 'responsable.NRO_DOCUMENTO'; - /** the column name for the FK_TIPODOCUMENTO_ID field */ + const FK_TIPODOCUMENTO_ID = 'responsable.FK_TIPODOCUMENTO_ID'; - /** the column name for the SEXO field */ + const SEXO = 'responsable.SEXO'; - /** the column name for the EMAIL field */ + const EMAIL = 'responsable.EMAIL'; - /** the column name for the RELACION field */ + const RELACION = 'responsable.RELACION'; - /** the column name for the OBSERVACION field */ + const OBSERVACION = 'responsable.OBSERVACION'; - /** the column name for the AUTORIZACION_RETIRO field */ + const AUTORIZACION_RETIRO = 'responsable.AUTORIZACION_RETIRO'; - /** the column name for the FK_CUENTA_ID field */ + const FK_CUENTA_ID = 'responsable.FK_CUENTA_ID'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Apellido', 'Direccion', 'Ciudad', 'CodigoPostal', 'FkProvinciaId', 'Telefono', 'TelefonoMovil', 'NroDocumento', 'FkTipodocumentoId', 'Sexo', 'Email', 'Relacion', 'Observacion', 'AutorizacionRetiro', 'FkCuentaId', ), BasePeer::TYPE_COLNAME => array (ResponsablePeer::ID, ResponsablePeer::NOMBRE, ResponsablePeer::APELLIDO, ResponsablePeer::DIRECCION, ResponsablePeer::CIUDAD, ResponsablePeer::CODIGO_POSTAL, ResponsablePeer::FK_PROVINCIA_ID, ResponsablePeer::TELEFONO, ResponsablePeer::TELEFONO_MOVIL, ResponsablePeer::NRO_DOCUMENTO, ResponsablePeer::FK_TIPODOCUMENTO_ID, ResponsablePeer::SEXO, ResponsablePeer::EMAIL, ResponsablePeer::RELACION, ResponsablePeer::OBSERVACION, ResponsablePeer::AUTORIZACION_RETIRO, ResponsablePeer::FK_CUENTA_ID, ), @@ -98,12 +82,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Apellido' => 2, 'Direccion' => 3, 'Ciudad' => 4, 'CodigoPostal' => 5, 'FkProvinciaId' => 6, 'Telefono' => 7, 'TelefonoMovil' => 8, 'NroDocumento' => 9, 'FkTipodocumentoId' => 10, 'Sexo' => 11, 'Email' => 12, 'Relacion' => 13, 'Observacion' => 14, 'AutorizacionRetiro' => 15, 'FkCuentaId' => 16, ), BasePeer::TYPE_COLNAME => array (ResponsablePeer::ID => 0, ResponsablePeer::NOMBRE => 1, ResponsablePeer::APELLIDO => 2, ResponsablePeer::DIRECCION => 3, ResponsablePeer::CIUDAD => 4, ResponsablePeer::CODIGO_POSTAL => 5, ResponsablePeer::FK_PROVINCIA_ID => 6, ResponsablePeer::TELEFONO => 7, ResponsablePeer::TELEFONO_MOVIL => 8, ResponsablePeer::NRO_DOCUMENTO => 9, ResponsablePeer::FK_TIPODOCUMENTO_ID => 10, ResponsablePeer::SEXO => 11, ResponsablePeer::EMAIL => 12, ResponsablePeer::RELACION => 13, ResponsablePeer::OBSERVACION => 14, ResponsablePeer::AUTORIZACION_RETIRO => 15, ResponsablePeer::FK_CUENTA_ID => 16, ), @@ -111,24 +90,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/ResponsableMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.ResponsableMapBuilder'); + include_once 'lib/model/map/ResponsableMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.ResponsableMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -142,15 +110,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -161,14 +121,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -178,34 +131,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ResponsablePeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(ResponsablePeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -248,29 +180,19 @@ const COUNT = 'COUNT(responsable.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT responsable.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -279,19 +201,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Responsable - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -302,33 +215,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return ResponsablePeer::populateObjects(ResponsablePeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -340,29 +232,18 @@ ResponsablePeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = ResponsablePeer::getOMClass(); + $cls = ResponsablePeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -372,29 +253,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Cuenta table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCuenta(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -405,35 +276,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -444,35 +304,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipodocumento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinTipodocumento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -483,25 +332,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Responsable objects pre-filled with their Cuenta objects. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCuenta(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -529,37 +370,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCuenta(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addResponsable($obj1); //CHECKME - break; + $temp_obj2->addResponsable($obj1); break; } } if ($newObject) { $obj2->initResponsables(); - $obj2->addResponsable($obj1); //CHECKME - } + $obj2->addResponsable($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Responsable objects pre-filled with their Provincia objects. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -587,37 +417,26 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addResponsable($obj1); //CHECKME - break; + $temp_obj2->addResponsable($obj1); break; } } if ($newObject) { $obj2->initResponsables(); - $obj2->addResponsable($obj1); //CHECKME - } + $obj2->addResponsable($obj1); } $results[] = $obj1; } return $results; } - /** - * Selects a collection of Responsable objects pre-filled with their Tipodocumento objects. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinTipodocumento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -645,46 +464,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getTipodocumento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addResponsable($obj1); //CHECKME - break; + $temp_obj2->addResponsable($obj1); break; } } if ($newObject) { $obj2->initResponsables(); - $obj2->addResponsable($obj1); //CHECKME - } + $obj2->addResponsable($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -699,25 +505,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Responsable objects pre-filled with all related objects. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -752,8 +550,7 @@ $obj1->hydrate($rs); - // Add objects for joined Cuenta rows - + $omClass = CuentaPeer::getOMClass(); @@ -764,11 +561,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCuenta(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCuenta(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addResponsable($obj1); // CHECKME - break; + $temp_obj2->addResponsable($obj1); break; } } @@ -778,8 +573,7 @@ } - // Add objects for joined Provincia rows - + $omClass = ProvinciaPeer::getOMClass(); @@ -790,11 +584,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getProvincia(); // CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getProvincia(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; - $temp_obj3->addResponsable($obj1); // CHECKME - break; + $temp_obj3->addResponsable($obj1); break; } } @@ -804,8 +596,7 @@ } - // Add objects for joined Tipodocumento rows - + $omClass = TipodocumentoPeer::getOMClass(); @@ -816,11 +607,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj4 = $temp_obj1->getTipodocumento(); // CHECKME - if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { + $temp_obj4 = $temp_obj1->getTipodocumento(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; - $temp_obj4->addResponsable($obj1); // CHECKME - break; + $temp_obj4->addResponsable($obj1); break; } } @@ -835,29 +624,19 @@ } - /** - * Returns the number of rows matching criteria, joining the related Cuenta table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptCuenta(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -870,35 +649,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Provincia table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptProvincia(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -911,35 +679,24 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Returns the number of rows matching criteria, joining the related Tipodocumento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAllExceptTipodocumento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(ResponsablePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ResponsablePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -952,27 +709,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Responsable objects pre-filled with all related objects except Cuenta. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptCuenta(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1011,8 +758,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getProvincia(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addResponsable($obj1); break; @@ -1034,8 +780,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocumento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addResponsable($obj1); break; @@ -1053,21 +798,12 @@ } - /** - * Selects a collection of Responsable objects pre-filled with all related objects except Provincia. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1106,8 +842,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCuenta(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addResponsable($obj1); break; @@ -1129,8 +864,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getTipodocumento(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getTipodocumento(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addResponsable($obj1); break; @@ -1148,21 +882,12 @@ } - /** - * Selects a collection of Responsable objects pre-filled with all related objects except Tipodocumento. - * - * @return array Array of Responsable objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAllExceptTipodocumento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - // $c->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -1201,8 +926,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCuenta(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCuenta(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addResponsable($obj1); break; @@ -1224,8 +948,7 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj3 = $temp_obj1->getProvincia(); //CHECKME - if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { + $temp_obj3 = $temp_obj1->getProvincia(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addResponsable($obj1); break; @@ -1242,41 +965,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return ResponsablePeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Responsable or Criteria object. - * - * @param mixed $values Criteria or Responsable object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -1284,21 +985,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Responsable object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(ResponsablePeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(ResponsablePeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -1309,15 +1004,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Responsable or Criteria object. - * - * @param mixed $values Criteria or Responsable object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -1327,37 +1014,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(ResponsablePeer::ID); $selectCriteria->add(ResponsablePeer::ID, $criteria->remove(ResponsablePeer::ID), $comparison); - } else { // $values is Responsable object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the responsable table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(ResponsablePeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -1367,17 +1042,7 @@ } } - /** - * Method perform a DELETE on the database, given a Responsable or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Responsable object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -1385,25 +1050,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Responsable) { + $criteria = clone $values; } elseif ($values instanceof Responsable) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(ResponsablePeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -1414,18 +1073,7 @@ } } - /** - * Validates all modified columns of given Responsable object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Responsable $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Responsable $obj, $cols = null) { $columns = array(); @@ -1460,13 +1108,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Responsable - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -1483,14 +1125,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -1508,20 +1143,14 @@ return $objs; } -} // BaseResponsablePeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseResponsablePeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/ResponsableMapBuilder.php'; - Propel::registerMapBuilder('model.map.ResponsableMapBuilder'); + require_once 'lib/model/map/ResponsableMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.ResponsableMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRol.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRol.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRol.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,136 +1,69 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/RolPeer.php'; - -/** - * Base class that represents a row from the 'rol' table. - * - * - * - * @package model.om - */ abstract class BaseRol extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var RolPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * The value for the activo field. - * @var boolean - */ + protected $activo = true; - /** - * Collection to store aggregation of collRelRolPermisos. - * @var array - */ + protected $collRelRolPermisos; - /** - * The criteria used to select the current contents of collRelRolPermisos. - * @var Criteria - */ + protected $lastRelRolPermisoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [activo] column value. - * - * @return boolean - */ + public function getActivo() { return $this->activo; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -139,14 +72,8 @@ $this->modifiedColumns[] = RolPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -155,14 +82,8 @@ $this->modifiedColumns[] = RolPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -171,14 +92,8 @@ $this->modifiedColumns[] = RolPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [activo] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActivo($v) { @@ -187,21 +102,8 @@ $this->modifiedColumns[] = RolPeer::ACTIVO; } - } // setActivo() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -218,23 +120,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = RolPeer::NUM_COLUMNS - RolPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Rol object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -256,16 +148,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -287,40 +170,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = RolPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += RolPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelRolPermisos !== null) { foreach($this->collRelRolPermisos as $referrerFK) { @@ -333,37 +199,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -376,16 +222,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -415,28 +252,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = RolPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -455,19 +278,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = RolPeer::getFieldNames($keyType); @@ -480,30 +293,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = RolPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -519,25 +316,9 @@ case 3: $this->setActivo($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RolPeer::getFieldNames($keyType); @@ -548,11 +329,7 @@ if (array_key_exists($keys[3], $arr)) $this->setActivo($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(RolPeer::DATABASE_NAME); @@ -565,14 +342,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(RolPeer::DATABASE_NAME); @@ -582,36 +352,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Rol (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -623,53 +376,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelRolPermisos() as $relObj) { $copyObj->addRelRolPermiso($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Rol Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return RolPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -678,12 +407,7 @@ return self::$peer; } - /** - * Temporary storage of collRelRolPermisos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelRolPermisos() { if ($this->collRelRolPermisos === null) { @@ -691,23 +415,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Rol has previously - * been saved, it will retrieve related RelRolPermisos from storage. - * If this Rol is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelRolPermisos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelRolPermisoPeer.php'; + include_once 'lib/model/om/BaseRelRolPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -727,13 +438,9 @@ $this->collRelRolPermisos = RelRolPermisoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelRolPermisoPeer::FK_ROL_ID, $this->getId()); RelRolPermisoPeer::addSelectColumns($criteria); @@ -746,18 +453,10 @@ return $this->collRelRolPermisos; } - /** - * Returns the number of related RelRolPermisos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelRolPermisos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelRolPermisoPeer.php'; + include_once 'lib/model/om/BaseRelRolPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -771,14 +470,7 @@ return RelRolPermisoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelRolPermiso object to this object - * through the RelRolPermiso foreign key attribute - * - * @param RelRolPermiso $l RelRolPermiso - * @return void - * @throws PropelException - */ + public function addRelRolPermiso(RelRolPermiso $l) { $this->collRelRolPermisos[] = $l; @@ -786,21 +478,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Rol is new, it will return - * an empty collection; or if this Rol has previously - * been saved, it will retrieve related RelRolPermisos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Rol. - */ + public function getRelRolPermisosJoinPermiso($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelRolPermisoPeer.php'; + include_once 'lib/model/om/BaseRelRolPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -819,10 +500,7 @@ $this->collRelRolPermisos = RelRolPermisoPeer::doSelectJoinPermiso($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelRolPermisoPeer::FK_ROL_ID, $this->getId()); if (!isset($this->lastRelRolPermisoCriteria) || !$this->lastRelRolPermisoCriteria->equals($criteria)) { @@ -834,4 +512,4 @@ return $this->collRelRolPermisos; } -} // BaseRol +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRolPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseRolPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseRolPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by RolPeer::getOMClass() -include_once 'model/Rol.php'; -/** - * Base static class for performing query and update operations on the 'rol' table. - * - * - * - * @package model.om - */ abstract class BaseRolPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'rol'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Rol'; + + const CLASS_DEFAULT = 'lib.model.Rol'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'rol.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'rol.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'rol.DESCRIPCION'; - /** the column name for the ACTIVO field */ + const ACTIVO = 'rol.ACTIVO'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'Activo', ), BasePeer::TYPE_COLNAME => array (RolPeer::ID, RolPeer::NOMBRE, RolPeer::DESCRIPCION, RolPeer::ACTIVO, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'Activo' => 3, ), BasePeer::TYPE_COLNAME => array (RolPeer::ID => 0, RolPeer::NOMBRE => 1, RolPeer::DESCRIPCION => 2, RolPeer::ACTIVO => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/RolMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.RolMapBuilder'); + include_once 'lib/model/map/RolMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.RolMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. RolPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(RolPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(rol.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT rol.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(RolPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(RolPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Rol - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return RolPeer::populateObjects(RolPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ RolPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = RolPeer::getOMClass(); + $cls = RolPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -306,41 +187,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return RolPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Rol or Criteria object. - * - * @param mixed $values Criteria or Rol object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -348,21 +207,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Rol object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(RolPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(RolPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -373,15 +226,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Rol or Criteria object. - * - * @param mixed $values Criteria or Rol object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -391,37 +236,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(RolPeer::ID); $selectCriteria->add(RolPeer::ID, $criteria->remove(RolPeer::ID), $comparison); - } else { // $values is Rol object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the rol table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(RolPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -431,17 +264,7 @@ } } - /** - * Method perform a DELETE on the database, given a Rol or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Rol object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -449,25 +272,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Rol) { + $criteria = clone $values; } elseif ($values instanceof Rol) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(RolPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -478,18 +295,7 @@ } } - /** - * Validates all modified columns of given Rol object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Rol $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Rol $obj, $cols = null) { $columns = array(); @@ -524,13 +330,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Rol - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -547,14 +347,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -572,20 +365,14 @@ return $objs; } -} // BaseRolPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseRolPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/RolMapBuilder.php'; - Propel::registerMapBuilder('model.map.RolMapBuilder'); + require_once 'lib/model/map/RolMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.RolMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistencia.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistencia.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistencia.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,172 +1,91 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TipoasistenciaPeer.php'; - -/** - * Base class that represents a row from the 'tipoasistencia' table. - * - * - * - * @package model.om - */ abstract class BaseTipoasistencia extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TipoasistenciaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * The value for the valor field. - * @var double - */ + protected $valor = 1; - /** - * The value for the grupo field. - * @var string - */ + protected $grupo = ''; - /** - * The value for the defecto field. - * @var boolean - */ + protected $defecto = false; - /** - * Collection to store aggregation of collAsistencias. - * @var array - */ + protected $collAsistencias; - /** - * The criteria used to select the current contents of collAsistencias. - * @var Criteria - */ + protected $lastAsistenciaCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [valor] column value. - * - * @return double - */ + public function getValor() { return $this->valor; } - /** - * Get the [grupo] column value. - * - * @return string - */ + public function getGrupo() { return $this->grupo; } - /** - * Get the [defecto] column value. - * - * @return boolean - */ + public function getDefecto() { return $this->defecto; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -175,14 +94,8 @@ $this->modifiedColumns[] = TipoasistenciaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -191,14 +104,8 @@ $this->modifiedColumns[] = TipoasistenciaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -207,14 +114,8 @@ $this->modifiedColumns[] = TipoasistenciaPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [valor] column. - * - * @param double $v new value - * @return void - */ + } + public function setValor($v) { @@ -223,14 +124,8 @@ $this->modifiedColumns[] = TipoasistenciaPeer::VALOR; } - } // setValor() - - /** - * Set the value of [grupo] column. - * - * @param string $v new value - * @return void - */ + } + public function setGrupo($v) { @@ -239,14 +134,8 @@ $this->modifiedColumns[] = TipoasistenciaPeer::GRUPO; } - } // setGrupo() - - /** - * Set the value of [defecto] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setDefecto($v) { @@ -255,21 +144,8 @@ $this->modifiedColumns[] = TipoasistenciaPeer::DEFECTO; } - } // setDefecto() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -290,23 +166,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 6; // 6 = TipoasistenciaPeer::NUM_COLUMNS - TipoasistenciaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 6; } catch (Exception $e) { throw new PropelException("Error populating Tipoasistencia object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -328,16 +194,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -359,40 +216,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TipoasistenciaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += TipoasistenciaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collAsistencias !== null) { foreach($this->collAsistencias as $referrerFK) { @@ -405,37 +245,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -448,16 +268,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -487,28 +298,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TipoasistenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -533,19 +330,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TipoasistenciaPeer::getFieldNames($keyType); @@ -560,30 +347,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TipoasistenciaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -605,25 +376,9 @@ case 5: $this->setDefecto($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TipoasistenciaPeer::getFieldNames($keyType); @@ -636,11 +391,7 @@ if (array_key_exists($keys[5], $arr)) $this->setDefecto($arr[$keys[5]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TipoasistenciaPeer::DATABASE_NAME); @@ -655,14 +406,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TipoasistenciaPeer::DATABASE_NAME); @@ -672,36 +416,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Tipoasistencia (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -717,53 +444,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getAsistencias() as $relObj) { $copyObj->addAsistencia($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Tipoasistencia Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TipoasistenciaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -772,12 +475,7 @@ return self::$peer; } - /** - * Temporary storage of collAsistencias to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAsistencias() { if ($this->collAsistencias === null) { @@ -785,23 +483,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoasistencia has previously - * been saved, it will retrieve related Asistencias from storage. - * If this Tipoasistencia is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAsistencias($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAsistenciaPeer.php'; + include_once 'lib/model/om/BaseAsistenciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -821,13 +506,9 @@ $this->collAsistencias = AsistenciaPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AsistenciaPeer::FK_TIPOASISTENCIA_ID, $this->getId()); AsistenciaPeer::addSelectColumns($criteria); @@ -840,18 +521,10 @@ return $this->collAsistencias; } - /** - * Returns the number of related Asistencias. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAsistencias($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAsistenciaPeer.php'; + include_once 'lib/model/om/BaseAsistenciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -865,14 +538,7 @@ return AsistenciaPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Asistencia object to this object - * through the Asistencia foreign key attribute - * - * @param Asistencia $l Asistencia - * @return void - * @throws PropelException - */ + public function addAsistencia(Asistencia $l) { $this->collAsistencias[] = $l; @@ -880,21 +546,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoasistencia is new, it will return - * an empty collection; or if this Tipoasistencia has previously - * been saved, it will retrieve related Asistencias from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipoasistencia. - */ + public function getAsistenciasJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAsistenciaPeer.php'; + include_once 'lib/model/om/BaseAsistenciaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -913,10 +568,7 @@ $this->collAsistencias = AsistenciaPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AsistenciaPeer::FK_TIPOASISTENCIA_ID, $this->getId()); if (!isset($this->lastAsistenciaCriteria) || !$this->lastAsistenciaCriteria->equals($criteria)) { @@ -928,4 +580,4 @@ return $this->collAsistencias; } -} // BaseTipoasistencia +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistenciaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistenciaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipoasistenciaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,63 +1,47 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TipoasistenciaPeer::getOMClass() -include_once 'model/Tipoasistencia.php'; -/** - * Base static class for performing query and update operations on the 'tipoasistencia' table. - * - * - * - * @package model.om - */ abstract class BaseTipoasistenciaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'tipoasistencia'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Tipoasistencia'; + + const CLASS_DEFAULT = 'lib.model.Tipoasistencia'; - /** The total number of columns. */ + const NUM_COLUMNS = 6; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'tipoasistencia.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'tipoasistencia.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'tipoasistencia.DESCRIPCION'; - /** the column name for the VALOR field */ + const VALOR = 'tipoasistencia.VALOR'; - /** the column name for the GRUPO field */ + const GRUPO = 'tipoasistencia.GRUPO'; - /** the column name for the DEFECTO field */ + const DEFECTO = 'tipoasistencia.DEFECTO'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'Valor', 'Grupo', 'Defecto', ), BasePeer::TYPE_COLNAME => array (TipoasistenciaPeer::ID, TipoasistenciaPeer::NOMBRE, TipoasistenciaPeer::DESCRIPCION, TipoasistenciaPeer::VALOR, TipoasistenciaPeer::GRUPO, TipoasistenciaPeer::DEFECTO, ), @@ -65,12 +49,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'Valor' => 3, 'Grupo' => 4, 'Defecto' => 5, ), BasePeer::TYPE_COLNAME => array (TipoasistenciaPeer::ID => 0, TipoasistenciaPeer::NOMBRE => 1, TipoasistenciaPeer::DESCRIPCION => 2, TipoasistenciaPeer::VALOR => 3, TipoasistenciaPeer::GRUPO => 4, TipoasistenciaPeer::DEFECTO => 5, ), @@ -78,24 +57,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TipoasistenciaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TipoasistenciaMapBuilder'); + include_once 'lib/model/map/TipoasistenciaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TipoasistenciaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -109,15 +77,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -128,14 +88,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -145,34 +98,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TipoasistenciaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TipoasistenciaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -193,29 +125,19 @@ const COUNT = 'COUNT(tipoasistencia.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT tipoasistencia.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TipoasistenciaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TipoasistenciaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -224,19 +146,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Tipoasistencia - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -247,33 +160,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TipoasistenciaPeer::populateObjects(TipoasistenciaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -285,29 +177,18 @@ TipoasistenciaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TipoasistenciaPeer::getOMClass(); + $cls = TipoasistenciaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -316,41 +197,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TipoasistenciaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Tipoasistencia or Criteria object. - * - * @param mixed $values Criteria or Tipoasistencia object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -358,21 +217,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Tipoasistencia object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(TipoasistenciaPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(TipoasistenciaPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -383,15 +236,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Tipoasistencia or Criteria object. - * - * @param mixed $values Criteria or Tipoasistencia object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -401,37 +246,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TipoasistenciaPeer::ID); $selectCriteria->add(TipoasistenciaPeer::ID, $criteria->remove(TipoasistenciaPeer::ID), $comparison); - } else { // $values is Tipoasistencia object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the tipoasistencia table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TipoasistenciaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -441,17 +274,7 @@ } } - /** - * Method perform a DELETE on the database, given a Tipoasistencia or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Tipoasistencia object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -459,25 +282,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Tipoasistencia) { + $criteria = clone $values; } elseif ($values instanceof Tipoasistencia) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TipoasistenciaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -488,18 +305,7 @@ } } - /** - * Validates all modified columns of given Tipoasistencia object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Tipoasistencia $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Tipoasistencia $obj, $cols = null) { $columns = array(); @@ -534,13 +340,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Tipoasistencia - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -557,14 +357,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -582,20 +375,14 @@ return $objs; } -} // BaseTipoasistenciaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTipoasistenciaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TipoasistenciaMapBuilder.php'; - Propel::registerMapBuilder('model.map.TipoasistenciaMapBuilder'); + require_once 'lib/model/map/TipoasistenciaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TipoasistenciaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipodocente.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipodocente.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipodocente.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TipodocentePeer.php'; - -/** - * Base class that represents a row from the 'tipodocente' table. - * - * - * - * @package model.om - */ abstract class BaseTipodocente extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TipodocentePeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * Collection to store aggregation of collRelDivisionActividadDocentes. - * @var array - */ + protected $collRelDivisionActividadDocentes; - /** - * The criteria used to select the current contents of collRelDivisionActividadDocentes. - * @var Criteria - */ + protected $lastRelDivisionActividadDocenteCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = TipodocentePeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = TipodocentePeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = TipodocentePeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = TipodocentePeer::NUM_COLUMNS - TipodocentePeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Tipodocente object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TipodocentePeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += TipodocentePeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelDivisionActividadDocentes !== null) { foreach($this->collRelDivisionActividadDocentes as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TipodocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TipodocentePeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TipodocentePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TipodocentePeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TipodocentePeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TipodocentePeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Tipodocente (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelDivisionActividadDocentes() as $relObj) { $copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Tipodocente Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TipodocentePeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collRelDivisionActividadDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelDivisionActividadDocentes() { if ($this->collRelDivisionActividadDocentes === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * If this Tipodocente is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelDivisionActividadDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, $this->getId()); RelDivisionActividadDocentePeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collRelDivisionActividadDocentes; } - /** - * Returns the number of related RelDivisionActividadDocentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelDivisionActividadDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return RelDivisionActividadDocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelDivisionActividadDocente object to this object - * through the RelDivisionActividadDocente foreign key attribute - * - * @param RelDivisionActividadDocente $l RelDivisionActividadDocente - * @return void - * @throws PropelException - */ + public function addRelDivisionActividadDocente(RelDivisionActividadDocente $l) { $this->collRelDivisionActividadDocentes[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocente is new, it will return - * an empty collection; or if this Tipodocente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocente. - */ + public function getRelDivisionActividadDocentesJoinDivision($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDivision($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -788,21 +479,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocente is new, it will return - * an empty collection; or if this Tipodocente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocente. - */ + public function getRelDivisionActividadDocentesJoinCargobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -821,10 +501,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinCargobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -837,21 +514,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocente is new, it will return - * an empty collection; or if this Tipodocente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocente. - */ + public function getRelDivisionActividadDocentesJoinDocente($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -870,10 +536,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinDocente($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -886,21 +549,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocente is new, it will return - * an empty collection; or if this Tipodocente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocente. - */ + public function getRelDivisionActividadDocentesJoinActividad($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -919,10 +571,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinActividad($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -935,21 +584,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocente is new, it will return - * an empty collection; or if this Tipodocente has previously - * been saved, it will retrieve related RelDivisionActividadDocentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocente. - */ + public function getRelDivisionActividadDocentesJoinRepeticion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelDivisionActividadDocentePeer.php'; + include_once 'lib/model/om/BaseRelDivisionActividadDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -968,10 +606,7 @@ $this->collRelDivisionActividadDocentes = RelDivisionActividadDocentePeer::doSelectJoinRepeticion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelDivisionActividadDocentePeer::FK_TIPODOCENTE_ID, $this->getId()); if (!isset($this->lastRelDivisionActividadDocenteCriteria) || !$this->lastRelDivisionActividadDocenteCriteria->equals($criteria)) { @@ -983,4 +618,4 @@ return $this->collRelDivisionActividadDocentes; } -} // BaseTipodocente +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipodocentePeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipodocentePeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipodocentePeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TipodocentePeer::getOMClass() -include_once 'model/Tipodocente.php'; -/** - * Base static class for performing query and update operations on the 'tipodocente' table. - * - * - * - * @package model.om - */ abstract class BaseTipodocentePeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'tipodocente'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Tipodocente'; + + const CLASS_DEFAULT = 'lib.model.Tipodocente'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'tipodocente.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'tipodocente.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'tipodocente.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (TipodocentePeer::ID, TipodocentePeer::NOMBRE, TipodocentePeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (TipodocentePeer::ID => 0, TipodocentePeer::NOMBRE => 1, TipodocentePeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TipodocenteMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TipodocenteMapBuilder'); + include_once 'lib/model/map/TipodocenteMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TipodocenteMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TipodocentePeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TipodocentePeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(tipodocente.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT tipodocente.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TipodocentePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TipodocentePeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Tipodocente - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TipodocentePeer::populateObjects(TipodocentePeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ TipodocentePeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TipodocentePeer::getOMClass(); + $cls = TipodocentePeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TipodocentePeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Tipodocente or Criteria object. - * - * @param mixed $values Criteria or Tipodocente object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Tipodocente object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(TipodocentePeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(TipodocentePeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Tipodocente or Criteria object. - * - * @param mixed $values Criteria or Tipodocente object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TipodocentePeer::ID); $selectCriteria->add(TipodocentePeer::ID, $criteria->remove(TipodocentePeer::ID), $comparison); - } else { // $values is Tipodocente object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the tipodocente table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TipodocentePeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Tipodocente or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Tipodocente object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Tipodocente) { + $criteria = clone $values; } elseif ($values instanceof Tipodocente) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TipodocentePeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Tipodocente object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Tipodocente $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Tipodocente $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Tipodocente - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseTipodocentePeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTipodocentePeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TipodocenteMapBuilder.php'; - Propel::registerMapBuilder('model.map.TipodocenteMapBuilder'); + require_once 'lib/model/map/TipodocenteMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TipodocenteMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumento.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumento.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,160 +1,81 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TipodocumentoPeer.php'; - -/** - * Base class that represents a row from the 'tipodocumento' table. - * - * - * - * @package model.om - */ abstract class BaseTipodocumento extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TipodocumentoPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * The value for the orden field. - * @var int - */ + protected $orden = 0; - /** - * Collection to store aggregation of collAlumnos. - * @var array - */ + protected $collAlumnos; - /** - * The criteria used to select the current contents of collAlumnos. - * @var Criteria - */ + protected $lastAlumnoCriteria = null; - /** - * Collection to store aggregation of collResponsables. - * @var array - */ + protected $collResponsables; - /** - * The criteria used to select the current contents of collResponsables. - * @var Criteria - */ + protected $lastResponsableCriteria = null; - /** - * Collection to store aggregation of collDocentes. - * @var array - */ + protected $collDocentes; - /** - * The criteria used to select the current contents of collDocentes. - * @var Criteria - */ + protected $lastDocenteCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Get the [orden] column value. - * - * @return int - */ + public function getOrden() { return $this->orden; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -163,14 +84,8 @@ $this->modifiedColumns[] = TipodocumentoPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -179,14 +94,8 @@ $this->modifiedColumns[] = TipodocumentoPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -195,14 +104,8 @@ $this->modifiedColumns[] = TipodocumentoPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Set the value of [orden] column. - * - * @param int $v new value - * @return void - */ + } + public function setOrden($v) { @@ -211,21 +114,8 @@ $this->modifiedColumns[] = TipodocumentoPeer::ORDEN; } - } // setOrden() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -242,23 +132,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 4; // 4 = TipodocumentoPeer::NUM_COLUMNS - TipodocumentoPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Tipodocumento object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -280,16 +160,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -311,40 +182,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TipodocumentoPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += TipodocumentoPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collAlumnos !== null) { foreach($this->collAlumnos as $referrerFK) { @@ -373,37 +227,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -416,16 +250,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -471,28 +296,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TipodocumentoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -511,19 +322,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TipodocumentoPeer::getFieldNames($keyType); @@ -536,30 +337,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TipodocumentoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -575,25 +360,9 @@ case 3: $this->setOrden($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TipodocumentoPeer::getFieldNames($keyType); @@ -604,11 +373,7 @@ if (array_key_exists($keys[3], $arr)) $this->setOrden($arr[$keys[3]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TipodocumentoPeer::DATABASE_NAME); @@ -621,14 +386,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TipodocumentoPeer::DATABASE_NAME); @@ -638,36 +396,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Tipodocumento (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -679,9 +420,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getAlumnos() as $relObj) { $copyObj->addAlumno($relObj->copy($deepCopy)); @@ -695,45 +434,23 @@ $copyObj->addDocente($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Tipodocumento Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TipodocumentoPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -742,12 +459,7 @@ return self::$peer; } - /** - * Temporary storage of collAlumnos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initAlumnos() { if ($this->collAlumnos === null) { @@ -755,23 +467,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento has previously - * been saved, it will retrieve related Alumnos from storage. - * If this Tipodocumento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getAlumnos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -791,13 +490,9 @@ $this->collAlumnos = AlumnoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(AlumnoPeer::FK_TIPODOCUMENTO_ID, $this->getId()); AlumnoPeer::addSelectColumns($criteria); @@ -810,18 +505,10 @@ return $this->collAlumnos; } - /** - * Returns the number of related Alumnos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countAlumnos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -835,14 +522,7 @@ return AlumnoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Alumno object to this object - * through the Alumno foreign key attribute - * - * @param Alumno $l Alumno - * @return void - * @throws PropelException - */ + public function addAlumno(Alumno $l) { $this->collAlumnos[] = $l; @@ -850,21 +530,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getAlumnosJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -883,10 +552,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -899,21 +565,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getAlumnosJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -932,10 +587,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -948,21 +600,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getAlumnosJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -981,10 +622,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -997,21 +635,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getAlumnosJoinConceptobaja($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1030,10 +657,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinConceptobaja($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1046,21 +670,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Alumnos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getAlumnosJoinPais($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseAlumnoPeer.php'; + include_once 'lib/model/om/BaseAlumnoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1079,10 +692,7 @@ $this->collAlumnos = AlumnoPeer::doSelectJoinPais($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(AlumnoPeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastAlumnoCriteria) || !$this->lastAlumnoCriteria->equals($criteria)) { @@ -1094,12 +704,7 @@ return $this->collAlumnos; } - /** - * Temporary storage of collResponsables to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initResponsables() { if ($this->collResponsables === null) { @@ -1107,23 +712,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento has previously - * been saved, it will retrieve related Responsables from storage. - * If this Tipodocumento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getResponsables($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1143,13 +735,9 @@ $this->collResponsables = ResponsablePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(ResponsablePeer::FK_TIPODOCUMENTO_ID, $this->getId()); ResponsablePeer::addSelectColumns($criteria); @@ -1162,18 +750,10 @@ return $this->collResponsables; } - /** - * Returns the number of related Responsables. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countResponsables($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1187,14 +767,7 @@ return ResponsablePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Responsable object to this object - * through the Responsable foreign key attribute - * - * @param Responsable $l Responsable - * @return void - * @throws PropelException - */ + public function addResponsable(Responsable $l) { $this->collResponsables[] = $l; @@ -1202,21 +775,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Responsables from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getResponsablesJoinCuenta($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1235,10 +797,7 @@ $this->collResponsables = ResponsablePeer::doSelectJoinCuenta($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ResponsablePeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastResponsableCriteria) || !$this->lastResponsableCriteria->equals($criteria)) { @@ -1251,21 +810,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Responsables from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getResponsablesJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseResponsablePeer.php'; + include_once 'lib/model/om/BaseResponsablePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1284,10 +832,7 @@ $this->collResponsables = ResponsablePeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(ResponsablePeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastResponsableCriteria) || !$this->lastResponsableCriteria->equals($criteria)) { @@ -1299,12 +844,7 @@ return $this->collResponsables; } - /** - * Temporary storage of collDocentes to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initDocentes() { if ($this->collDocentes === null) { @@ -1312,23 +852,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento has previously - * been saved, it will retrieve related Docentes from storage. - * If this Tipodocumento is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getDocentes($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1348,13 +875,9 @@ $this->collDocentes = DocentePeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(DocentePeer::FK_TIPODOCUMENTO_ID, $this->getId()); DocentePeer::addSelectColumns($criteria); @@ -1367,18 +890,10 @@ return $this->collDocentes; } - /** - * Returns the number of related Docentes. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countDocentes($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1392,14 +907,7 @@ return DocentePeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Docente object to this object - * through the Docente foreign key attribute - * - * @param Docente $l Docente - * @return void - * @throws PropelException - */ + public function addDocente(Docente $l) { $this->collDocentes[] = $l; @@ -1407,21 +915,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipodocumento is new, it will return - * an empty collection; or if this Tipodocumento has previously - * been saved, it will retrieve related Docentes from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipodocumento. - */ + public function getDocentesJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDocentePeer.php'; + include_once 'lib/model/om/BaseDocentePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1440,10 +937,7 @@ $this->collDocentes = DocentePeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(DocentePeer::FK_TIPODOCUMENTO_ID, $this->getId()); if (!isset($this->lastDocenteCriteria) || !$this->lastDocenteCriteria->equals($criteria)) { @@ -1455,4 +949,4 @@ return $this->collDocentes; } -} // BaseTipodocumento +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumentoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumentoPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipodocumentoPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,57 +1,41 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TipodocumentoPeer::getOMClass() -include_once 'model/Tipodocumento.php'; -/** - * Base static class for performing query and update operations on the 'tipodocumento' table. - * - * - * - * @package model.om - */ abstract class BaseTipodocumentoPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'tipodocumento'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Tipodocumento'; + + const CLASS_DEFAULT = 'lib.model.Tipodocumento'; - /** The total number of columns. */ + const NUM_COLUMNS = 4; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'tipodocumento.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'tipodocumento.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'tipodocumento.DESCRIPCION'; - /** the column name for the ORDEN field */ + const ORDEN = 'tipodocumento.ORDEN'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', 'Orden', ), BasePeer::TYPE_COLNAME => array (TipodocumentoPeer::ID, TipodocumentoPeer::NOMBRE, TipodocumentoPeer::DESCRIPCION, TipodocumentoPeer::ORDEN, ), @@ -59,12 +43,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, 'Orden' => 3, ), BasePeer::TYPE_COLNAME => array (TipodocumentoPeer::ID => 0, TipodocumentoPeer::NOMBRE => 1, TipodocumentoPeer::DESCRIPCION => 2, TipodocumentoPeer::ORDEN => 3, ), @@ -72,24 +51,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TipodocumentoMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TipodocumentoMapBuilder'); + include_once 'lib/model/map/TipodocumentoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TipodocumentoMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -103,15 +71,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -122,14 +82,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -139,34 +92,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TipodocumentoPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TipodocumentoPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -183,29 +115,19 @@ const COUNT = 'COUNT(tipodocumento.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT tipodocumento.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TipodocumentoPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TipodocumentoPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -214,19 +136,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Tipodocumento - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -237,33 +150,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TipodocumentoPeer::populateObjects(TipodocumentoPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -275,29 +167,18 @@ TipodocumentoPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TipodocumentoPeer::getOMClass(); + $cls = TipodocumentoPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -306,41 +187,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TipodocumentoPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Tipodocumento or Criteria object. - * - * @param mixed $values Criteria or Tipodocumento object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -348,21 +207,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Tipodocumento object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(TipodocumentoPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(TipodocumentoPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -373,15 +226,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Tipodocumento or Criteria object. - * - * @param mixed $values Criteria or Tipodocumento object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -391,37 +236,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TipodocumentoPeer::ID); $selectCriteria->add(TipodocumentoPeer::ID, $criteria->remove(TipodocumentoPeer::ID), $comparison); - } else { // $values is Tipodocumento object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the tipodocumento table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TipodocumentoPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -431,17 +264,7 @@ } } - /** - * Method perform a DELETE on the database, given a Tipodocumento or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Tipodocumento object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -449,25 +272,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Tipodocumento) { + $criteria = clone $values; } elseif ($values instanceof Tipodocumento) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TipodocumentoPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -478,18 +295,7 @@ } } - /** - * Validates all modified columns of given Tipodocumento object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Tipodocumento $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Tipodocumento $obj, $cols = null) { $columns = array(); @@ -524,13 +330,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Tipodocumento - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -547,14 +347,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -572,20 +365,14 @@ return $objs; } -} // BaseTipodocumentoPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTipodocumentoPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TipodocumentoMapBuilder.php'; - Propel::registerMapBuilder('model.map.TipodocumentoMapBuilder'); + require_once 'lib/model/map/TipodocumentoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TipodocumentoMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacio.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacio.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacio.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TipoespacioPeer.php'; - -/** - * Base class that represents a row from the 'tipoespacio' table. - * - * - * - * @package model.om - */ abstract class BaseTipoespacio extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TipoespacioPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * Collection to store aggregation of collEspacios. - * @var array - */ + protected $collEspacios; - /** - * The criteria used to select the current contents of collEspacios. - * @var Criteria - */ + protected $lastEspacioCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = TipoespacioPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = TipoespacioPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = TipoespacioPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = TipoespacioPeer::NUM_COLUMNS - TipoespacioPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Tipoespacio object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TipoespacioPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += TipoespacioPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collEspacios !== null) { foreach($this->collEspacios as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TipoespacioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TipoespacioPeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TipoespacioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TipoespacioPeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TipoespacioPeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TipoespacioPeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Tipoespacio (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getEspacios() as $relObj) { $copyObj->addEspacio($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Tipoespacio Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TipoespacioPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collEspacios to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initEspacios() { if ($this->collEspacios === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoespacio has previously - * been saved, it will retrieve related Espacios from storage. - * If this Tipoespacio is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getEspacios($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collEspacios = EspacioPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(EspacioPeer::FK_TIPOESPACIO_ID, $this->getId()); EspacioPeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collEspacios; } - /** - * Returns the number of related Espacios. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countEspacios($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return EspacioPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Espacio object to this object - * through the Espacio foreign key attribute - * - * @param Espacio $l Espacio - * @return void - * @throws PropelException - */ + public function addEspacio(Espacio $l) { $this->collEspacios[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoespacio is new, it will return - * an empty collection; or if this Tipoespacio has previously - * been saved, it will retrieve related Espacios from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipoespacio. - */ + public function getEspaciosJoinLocacion($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseEspacioPeer.php'; + include_once 'lib/model/om/BaseEspacioPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collEspacios = EspacioPeer::doSelectJoinLocacion($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(EspacioPeer::FK_TIPOESPACIO_ID, $this->getId()); if (!isset($this->lastEspacioCriteria) || !$this->lastEspacioCriteria->equals($criteria)) { @@ -787,4 +478,4 @@ return $this->collEspacios; } -} // BaseTipoespacio +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipoespacioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TipoespacioPeer::getOMClass() -include_once 'model/Tipoespacio.php'; -/** - * Base static class for performing query and update operations on the 'tipoespacio' table. - * - * - * - * @package model.om - */ abstract class BaseTipoespacioPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'tipoespacio'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Tipoespacio'; + + const CLASS_DEFAULT = 'lib.model.Tipoespacio'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'tipoespacio.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'tipoespacio.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'tipoespacio.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (TipoespacioPeer::ID, TipoespacioPeer::NOMBRE, TipoespacioPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (TipoespacioPeer::ID => 0, TipoespacioPeer::NOMBRE => 1, TipoespacioPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TipoespacioMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TipoespacioMapBuilder'); + include_once 'lib/model/map/TipoespacioMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TipoespacioMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TipoespacioPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TipoespacioPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(tipoespacio.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT tipoespacio.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TipoespacioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TipoespacioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Tipoespacio - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TipoespacioPeer::populateObjects(TipoespacioPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ TipoespacioPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TipoespacioPeer::getOMClass(); + $cls = TipoespacioPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TipoespacioPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Tipoespacio or Criteria object. - * - * @param mixed $values Criteria or Tipoespacio object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Tipoespacio object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(TipoespacioPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(TipoespacioPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Tipoespacio or Criteria object. - * - * @param mixed $values Criteria or Tipoespacio object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TipoespacioPeer::ID); $selectCriteria->add(TipoespacioPeer::ID, $criteria->remove(TipoespacioPeer::ID), $comparison); - } else { // $values is Tipoespacio object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the tipoespacio table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TipoespacioPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Tipoespacio or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Tipoespacio object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Tipoespacio) { + $criteria = clone $values; } elseif ($values instanceof Tipoespacio) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TipoespacioPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Tipoespacio object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Tipoespacio $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Tipoespacio $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Tipoespacio - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseTipoespacioPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTipoespacioPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TipoespacioMapBuilder.php'; - Propel::registerMapBuilder('model.map.TipoespacioMapBuilder'); + require_once 'lib/model/map/TipoespacioMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TipoespacioMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipoiva.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipoiva.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipoiva.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,130 +1,64 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TipoivaPeer.php'; - -/** - * Base class that represents a row from the 'tipoiva' table. - * - * - * - * @package model.om - */ abstract class BaseTipoiva extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TipoivaPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * Collection to store aggregation of collOrganizacions. - * @var array - */ + protected $collOrganizacions; - /** - * The criteria used to select the current contents of collOrganizacions. - * @var Criteria - */ + protected $lastOrganizacionCriteria = null; - /** - * Collection to store aggregation of collCuentas. - * @var array - */ + protected $collCuentas; - /** - * The criteria used to select the current contents of collCuentas. - * @var Criteria - */ + protected $lastCuentaCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -133,14 +67,8 @@ $this->modifiedColumns[] = TipoivaPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -149,14 +77,8 @@ $this->modifiedColumns[] = TipoivaPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -165,21 +87,8 @@ $this->modifiedColumns[] = TipoivaPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -194,23 +103,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = TipoivaPeer::NUM_COLUMNS - TipoivaPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Tipoiva object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -232,16 +131,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -263,38 +153,22 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TipoivaPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - + $affectedRows += 1; $this->setNew(false); } else { $affectedRows += TipoivaPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collOrganizacions !== null) { foreach($this->collOrganizacions as $referrerFK) { @@ -315,37 +189,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -358,16 +212,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -405,28 +250,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TipoivaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -442,19 +273,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TipoivaPeer::getFieldNames($keyType); @@ -466,30 +287,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TipoivaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -502,25 +307,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TipoivaPeer::getFieldNames($keyType); @@ -530,11 +319,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TipoivaPeer::DATABASE_NAME); @@ -546,14 +331,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TipoivaPeer::DATABASE_NAME); @@ -563,36 +341,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Tipoiva (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -602,9 +363,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getOrganizacions() as $relObj) { $copyObj->addOrganizacion($relObj->copy($deepCopy)); @@ -614,45 +373,23 @@ $copyObj->addCuenta($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Tipoiva Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TipoivaPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -661,12 +398,7 @@ return self::$peer; } - /** - * Temporary storage of collOrganizacions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initOrganizacions() { if ($this->collOrganizacions === null) { @@ -674,23 +406,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoiva has previously - * been saved, it will retrieve related Organizacions from storage. - * If this Tipoiva is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getOrganizacions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -710,13 +429,9 @@ $this->collOrganizacions = OrganizacionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(OrganizacionPeer::FK_TIPOIVA_ID, $this->getId()); OrganizacionPeer::addSelectColumns($criteria); @@ -729,18 +444,10 @@ return $this->collOrganizacions; } - /** - * Returns the number of related Organizacions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countOrganizacions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -754,14 +461,7 @@ return OrganizacionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Organizacion object to this object - * through the Organizacion foreign key attribute - * - * @param Organizacion $l Organizacion - * @return void - * @throws PropelException - */ + public function addOrganizacion(Organizacion $l) { $this->collOrganizacions[] = $l; @@ -769,21 +469,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoiva is new, it will return - * an empty collection; or if this Tipoiva has previously - * been saved, it will retrieve related Organizacions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipoiva. - */ + public function getOrganizacionsJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseOrganizacionPeer.php'; + include_once 'lib/model/om/BaseOrganizacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -802,10 +491,7 @@ $this->collOrganizacions = OrganizacionPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(OrganizacionPeer::FK_TIPOIVA_ID, $this->getId()); if (!isset($this->lastOrganizacionCriteria) || !$this->lastOrganizacionCriteria->equals($criteria)) { @@ -817,12 +503,7 @@ return $this->collOrganizacions; } - /** - * Temporary storage of collCuentas to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initCuentas() { if ($this->collCuentas === null) { @@ -830,23 +511,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoiva has previously - * been saved, it will retrieve related Cuentas from storage. - * If this Tipoiva is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getCuentas($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -866,13 +534,9 @@ $this->collCuentas = CuentaPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(CuentaPeer::FK_TIPOIVA_ID, $this->getId()); CuentaPeer::addSelectColumns($criteria); @@ -885,18 +549,10 @@ return $this->collCuentas; } - /** - * Returns the number of related Cuentas. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countCuentas($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -910,14 +566,7 @@ return CuentaPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Cuenta object to this object - * through the Cuenta foreign key attribute - * - * @param Cuenta $l Cuenta - * @return void - * @throws PropelException - */ + public function addCuenta(Cuenta $l) { $this->collCuentas[] = $l; @@ -925,21 +574,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipoiva is new, it will return - * an empty collection; or if this Tipoiva has previously - * been saved, it will retrieve related Cuentas from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipoiva. - */ + public function getCuentasJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseCuentaPeer.php'; + include_once 'lib/model/om/BaseCuentaPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -958,10 +596,7 @@ $this->collCuentas = CuentaPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(CuentaPeer::FK_TIPOIVA_ID, $this->getId()); if (!isset($this->lastCuentaCriteria) || !$this->lastCuentaCriteria->equals($criteria)) { @@ -973,4 +608,4 @@ return $this->collCuentas; } -} // BaseTipoiva +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipoivaPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipoivaPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipoivaPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TipoivaPeer::getOMClass() -include_once 'model/Tipoiva.php'; -/** - * Base static class for performing query and update operations on the 'tipoiva' table. - * - * - * - * @package model.om - */ abstract class BaseTipoivaPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'tipoiva'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Tipoiva'; + + const CLASS_DEFAULT = 'lib.model.Tipoiva'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'tipoiva.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'tipoiva.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'tipoiva.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (TipoivaPeer::ID, TipoivaPeer::NOMBRE, TipoivaPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (TipoivaPeer::ID => 0, TipoivaPeer::NOMBRE => 1, TipoivaPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TipoivaMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TipoivaMapBuilder'); + include_once 'lib/model/map/TipoivaMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TipoivaMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TipoivaPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TipoivaPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(tipoiva.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT tipoiva.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TipoivaPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TipoivaPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Tipoiva - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TipoivaPeer::populateObjects(TipoivaPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ TipoivaPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TipoivaPeer::getOMClass(); + $cls = TipoivaPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TipoivaPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Tipoiva or Criteria object. - * - * @param mixed $values Criteria or Tipoiva object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,19 +202,14 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Tipoiva object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -366,15 +220,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Tipoiva or Criteria object. - * - * @param mixed $values Criteria or Tipoiva object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -384,37 +230,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TipoivaPeer::ID); $selectCriteria->add(TipoivaPeer::ID, $criteria->remove(TipoivaPeer::ID), $comparison); - } else { // $values is Tipoiva object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the tipoiva table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TipoivaPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -424,17 +258,7 @@ } } - /** - * Method perform a DELETE on the database, given a Tipoiva or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Tipoiva object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -442,25 +266,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Tipoiva) { + $criteria = clone $values; } elseif ($values instanceof Tipoiva) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TipoivaPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -471,18 +289,7 @@ } } - /** - * Validates all modified columns of given Tipoiva object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Tipoiva $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Tipoiva $obj, $cols = null) { $columns = array(); @@ -517,13 +324,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Tipoiva - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -540,14 +341,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -565,20 +359,14 @@ return $objs; } -} // BaseTipoivaPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTipoivaPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TipoivaMapBuilder.php'; - Propel::registerMapBuilder('model.map.TipoivaMapBuilder'); + require_once 'lib/model/map/TipoivaMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TipoivaMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacion.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacion.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacion.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,118 +1,58 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TipolocacionPeer.php'; - -/** - * Base class that represents a row from the 'tipolocacion' table. - * - * - * - * @package model.om - */ abstract class BaseTipolocacion extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TipolocacionPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the nombre field. - * @var string - */ + protected $nombre = ''; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * Collection to store aggregation of collLocacions. - * @var array - */ + protected $collLocacions; - /** - * The criteria used to select the current contents of collLocacions. - * @var Criteria - */ + protected $lastLocacionCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [nombre] column value. - * - * @return string - */ + public function getNombre() { return $this->nombre; } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -121,14 +61,8 @@ $this->modifiedColumns[] = TipolocacionPeer::ID; } - } // setId() - - /** - * Set the value of [nombre] column. - * - * @param string $v new value - * @return void - */ + } + public function setNombre($v) { @@ -137,14 +71,8 @@ $this->modifiedColumns[] = TipolocacionPeer::NOMBRE; } - } // setNombre() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -153,21 +81,8 @@ $this->modifiedColumns[] = TipolocacionPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -182,23 +97,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 3; // 3 = TipolocacionPeer::NUM_COLUMNS - TipolocacionPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Tipolocacion object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -220,16 +125,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -251,40 +147,23 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TipolocacionPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += TipolocacionPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collLocacions !== null) { foreach($this->collLocacions as $referrerFK) { @@ -297,37 +176,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -340,16 +199,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -379,28 +229,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TipolocacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -416,19 +252,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TipolocacionPeer::getFieldNames($keyType); @@ -440,30 +266,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TipolocacionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -476,25 +286,9 @@ case 2: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TipolocacionPeer::getFieldNames($keyType); @@ -504,11 +298,7 @@ if (array_key_exists($keys[2], $arr)) $this->setDescripcion($arr[$keys[2]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TipolocacionPeer::DATABASE_NAME); @@ -520,14 +310,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TipolocacionPeer::DATABASE_NAME); @@ -537,36 +320,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Tipolocacion (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -576,53 +342,29 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getLocacions() as $relObj) { $copyObj->addLocacion($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Tipolocacion Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TipolocacionPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -631,12 +373,7 @@ return self::$peer; } - /** - * Temporary storage of collLocacions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLocacions() { if ($this->collLocacions === null) { @@ -644,23 +381,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipolocacion has previously - * been saved, it will retrieve related Locacions from storage. - * If this Tipolocacion is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLocacions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -680,13 +404,9 @@ $this->collLocacions = LocacionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LocacionPeer::FK_TIPOLOCACION_ID, $this->getId()); LocacionPeer::addSelectColumns($criteria); @@ -699,18 +419,10 @@ return $this->collLocacions; } - /** - * Returns the number of related Locacions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLocacions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -724,14 +436,7 @@ return LocacionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Locacion object to this object - * through the Locacion foreign key attribute - * - * @param Locacion $l Locacion - * @return void - * @throws PropelException - */ + public function addLocacion(Locacion $l) { $this->collLocacions[] = $l; @@ -739,21 +444,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Tipolocacion is new, it will return - * an empty collection; or if this Tipolocacion has previously - * been saved, it will retrieve related Locacions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Tipolocacion. - */ + public function getLocacionsJoinProvincia($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLocacionPeer.php'; + include_once 'lib/model/om/BaseLocacionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -772,10 +466,7 @@ $this->collLocacions = LocacionPeer::doSelectJoinProvincia($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LocacionPeer::FK_TIPOLOCACION_ID, $this->getId()); if (!isset($this->lastLocacionCriteria) || !$this->lastLocacionCriteria->equals($criteria)) { @@ -787,4 +478,4 @@ return $this->collLocacions; } -} // BaseTipolocacion +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacionPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacionPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTipolocacionPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,54 +1,38 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TipolocacionPeer::getOMClass() -include_once 'model/Tipolocacion.php'; -/** - * Base static class for performing query and update operations on the 'tipolocacion' table. - * - * - * - * @package model.om - */ abstract class BaseTipolocacionPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'tipolocacion'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Tipolocacion'; + + const CLASS_DEFAULT = 'lib.model.Tipolocacion'; - /** The total number of columns. */ + const NUM_COLUMNS = 3; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'tipolocacion.ID'; - /** the column name for the NOMBRE field */ + const NOMBRE = 'tipolocacion.NOMBRE'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'tipolocacion.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (TipolocacionPeer::ID, TipolocacionPeer::NOMBRE, TipolocacionPeer::DESCRIPCION, ), @@ -56,12 +40,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, 'Descripcion' => 2, ), BasePeer::TYPE_COLNAME => array (TipolocacionPeer::ID => 0, TipolocacionPeer::NOMBRE => 1, TipolocacionPeer::DESCRIPCION => 2, ), @@ -69,24 +48,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TipolocacionMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TipolocacionMapBuilder'); + include_once 'lib/model/map/TipolocacionMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TipolocacionMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -100,15 +68,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -119,14 +79,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -136,34 +89,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TipolocacionPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TipolocacionPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -178,29 +110,19 @@ const COUNT = 'COUNT(tipolocacion.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT tipolocacion.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TipolocacionPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TipolocacionPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -209,19 +131,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Tipolocacion - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -232,33 +145,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TipolocacionPeer::populateObjects(TipolocacionPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -270,29 +162,18 @@ TipolocacionPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TipolocacionPeer::getOMClass(); + $cls = TipolocacionPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -301,41 +182,19 @@ } return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TipolocacionPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Tipolocacion or Criteria object. - * - * @param mixed $values Criteria or Tipolocacion object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -343,21 +202,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Tipolocacion object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(TipolocacionPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(TipolocacionPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -368,15 +221,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Tipolocacion or Criteria object. - * - * @param mixed $values Criteria or Tipolocacion object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -386,37 +231,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TipolocacionPeer::ID); $selectCriteria->add(TipolocacionPeer::ID, $criteria->remove(TipolocacionPeer::ID), $comparison); - } else { // $values is Tipolocacion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the tipolocacion table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TipolocacionPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -426,17 +259,7 @@ } } - /** - * Method perform a DELETE on the database, given a Tipolocacion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Tipolocacion object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -444,25 +267,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Tipolocacion) { + $criteria = clone $values; } elseif ($values instanceof Tipolocacion) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TipolocacionPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -473,18 +290,7 @@ } } - /** - * Validates all modified columns of given Tipolocacion object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Tipolocacion $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Tipolocacion $obj, $cols = null) { $columns = array(); @@ -519,13 +325,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Tipolocacion - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -542,14 +342,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -567,20 +360,14 @@ return $objs; } -} // BaseTipolocacionPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTipolocacionPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TipolocacionMapBuilder.php'; - Propel::registerMapBuilder('model.map.TipolocacionMapBuilder'); + require_once 'lib/model/map/TipolocacionMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TipolocacionMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTurnos.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTurnos.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTurnos.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,150 +1,76 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/TurnosPeer.php'; - -/** - * Base class that represents a row from the 'turnos' table. - * - * - * - * @package model.om - */ abstract class BaseTurnos extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var TurnosPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the fk_ciclolectivo_id field. - * @var int - */ + protected $fk_ciclolectivo_id; - /** - * The value for the hora_inicio field. - * @var int - */ + protected $hora_inicio; - /** - * The value for the hora_fin field. - * @var int - */ + protected $hora_fin; - /** - * The value for the descripcion field. - * @var string - */ + protected $descripcion = ''; - /** - * @var Ciclolectivo - */ + protected $aCiclolectivo; - /** - * Collection to store aggregation of collDivisions. - * @var array - */ + protected $collDivisions; - /** - * The criteria used to select the current contents of collDivisions. - * @var Criteria - */ + protected $lastDivisionCriteria = null; - /** - * Collection to store aggregation of collHorarioescolars. - * @var array - */ + protected $collHorarioescolars; - /** - * The criteria used to select the current contents of collHorarioescolars. - * @var Criteria - */ + protected $lastHorarioescolarCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [fk_ciclolectivo_id] column value. - * - * @return int - */ + public function getFkCiclolectivoId() { return $this->fk_ciclolectivo_id; } - /** - * Get the [optionally formatted] [hora_inicio] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraInicio($format = '%X') + + public function getHoraInicio($format = 'H:i:s') { if ($this->hora_inicio === null || $this->hora_inicio === '') { return null; } elseif (!is_int($this->hora_inicio)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_inicio); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); + $ts = strtotime($this->hora_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true)); } } else { $ts = $this->hora_inicio; @@ -158,24 +84,15 @@ } } - /** - * Get the [optionally formatted] [hora_fin] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getHoraFin($format = '%X') + + public function getHoraFin($format = 'H:i:s') { if ($this->hora_fin === null || $this->hora_fin === '') { return null; } elseif (!is_int($this->hora_fin)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->hora_fin); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); + $ts = strtotime($this->hora_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true)); } } else { $ts = $this->hora_fin; @@ -189,23 +106,14 @@ } } - /** - * Get the [descripcion] column value. - * - * @return string - */ + public function getDescripcion() { return $this->descripcion; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -214,14 +122,8 @@ $this->modifiedColumns[] = TurnosPeer::ID; } - } // setId() - - /** - * Set the value of [fk_ciclolectivo_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkCiclolectivoId($v) { @@ -234,21 +136,14 @@ $this->aCiclolectivo = null; } - } // setFkCiclolectivoId() - - /** - * Set the value of [hora_inicio] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraInicio($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -258,21 +153,14 @@ $this->modifiedColumns[] = TurnosPeer::HORA_INICIO; } - } // setHoraInicio() - - /** - * Set the value of [hora_fin] column. - * - * @param int $v new value - * @return void - */ + } + public function setHoraFin($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -282,14 +170,8 @@ $this->modifiedColumns[] = TurnosPeer::HORA_FIN; } - } // setHoraFin() - - /** - * Set the value of [descripcion] column. - * - * @param string $v new value - * @return void - */ + } + public function setDescripcion($v) { @@ -298,21 +180,8 @@ $this->modifiedColumns[] = TurnosPeer::DESCRIPCION; } - } // setDescripcion() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -331,23 +200,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = TurnosPeer::NUM_COLUMNS - TurnosPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 5; } catch (Exception $e) { throw new PropelException("Error populating Turnos object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -369,16 +228,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -400,29 +250,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCiclolectivo !== null) { if ($this->aCiclolectivo->isModified()) { $affectedRows += $this->aCiclolectivo->save($con); @@ -431,22 +266,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = TurnosPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += TurnosPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collDivisions !== null) { foreach($this->collDivisions as $referrerFK) { @@ -467,37 +296,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -510,16 +319,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -529,11 +329,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aCiclolectivo !== null) { if (!$this->aCiclolectivo->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCiclolectivo->getValidationFailures()); @@ -569,28 +365,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = TurnosPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -612,19 +394,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = TurnosPeer::getFieldNames($keyType); @@ -638,30 +410,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TurnosPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -680,25 +436,9 @@ case 4: $this->setDescripcion($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TurnosPeer::getFieldNames($keyType); @@ -710,11 +450,7 @@ if (array_key_exists($keys[4], $arr)) $this->setDescripcion($arr[$keys[4]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(TurnosPeer::DATABASE_NAME); @@ -728,14 +464,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(TurnosPeer::DATABASE_NAME); @@ -745,36 +474,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Turnos (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -788,9 +500,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getDivisions() as $relObj) { $copyObj->addDivision($relObj->copy($deepCopy)); @@ -800,45 +510,23 @@ $copyObj->addHorarioescolar($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Turnos Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TurnosPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -847,13 +535,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Ciclolectivo object. - * - * @param Ciclolectivo $v - * @return void - * @throws PropelException - */ + public function setCiclolectivo($v) { @@ -869,41 +551,21 @@ } - /** - * Get the associated Ciclolectivo object - * - * @param Connection Optional Connection object. - * @return Ciclolectivo The associated Ciclolectivo object. - * @throws PropelException - */ + public function getCiclolectivo($con = null) { - // include the related Peer class - include_once 'model/om/BaseCiclolectivoPeer.php'; + include_once 'lib/model/om/BaseCiclolectivoPeer.php'; if ($this->aCiclolectivo === null && ($this->fk_ciclolectivo_id !== null)) { $this->aCiclolectivo = CiclolectivoPeer::retrieveByPK($this->fk_ciclolectivo_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = CiclolectivoPeer::retrieveByPK($this->fk_ciclolectivo_id, $con); - $obj->addCiclolectivos($this); - */ + } return $this->aCiclolectivo; } - /** - * Temporary storage of collDivisions to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initDivisions() { if ($this->collDivisions === null) { @@ -911,23 +573,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Turnos has previously - * been saved, it will retrieve related Divisions from storage. - * If this Turnos is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getDivisions($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -947,13 +596,9 @@ $this->collDivisions = DivisionPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(DivisionPeer::FK_TURNOS_ID, $this->getId()); DivisionPeer::addSelectColumns($criteria); @@ -966,18 +611,10 @@ return $this->collDivisions; } - /** - * Returns the number of related Divisions. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countDivisions($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -991,14 +628,7 @@ return DivisionPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Division object to this object - * through the Division foreign key attribute - * - * @param Division $l Division - * @return void - * @throws PropelException - */ + public function addDivision(Division $l) { $this->collDivisions[] = $l; @@ -1006,21 +636,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Turnos is new, it will return - * an empty collection; or if this Turnos has previously - * been saved, it will retrieve related Divisions from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Turnos. - */ + public function getDivisionsJoinAnio($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseDivisionPeer.php'; + include_once 'lib/model/om/BaseDivisionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1039,10 +658,7 @@ $this->collDivisions = DivisionPeer::doSelectJoinAnio($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(DivisionPeer::FK_TURNOS_ID, $this->getId()); if (!isset($this->lastDivisionCriteria) || !$this->lastDivisionCriteria->equals($criteria)) { @@ -1054,12 +670,7 @@ return $this->collDivisions; } - /** - * Temporary storage of collHorarioescolars to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initHorarioescolars() { if ($this->collHorarioescolars === null) { @@ -1067,23 +678,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Turnos has previously - * been saved, it will retrieve related Horarioescolars from storage. - * If this Turnos is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getHorarioescolars($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1103,13 +701,9 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(HorarioescolarPeer::FK_TURNOS_ID, $this->getId()); HorarioescolarPeer::addSelectColumns($criteria); @@ -1122,18 +716,10 @@ return $this->collHorarioescolars; } - /** - * Returns the number of related Horarioescolars. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countHorarioescolars($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1147,14 +733,7 @@ return HorarioescolarPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Horarioescolar object to this object - * through the Horarioescolar foreign key attribute - * - * @param Horarioescolar $l Horarioescolar - * @return void - * @throws PropelException - */ + public function addHorarioescolar(Horarioescolar $l) { $this->collHorarioescolars[] = $l; @@ -1162,21 +741,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Turnos is new, it will return - * an empty collection; or if this Turnos has previously - * been saved, it will retrieve related Horarioescolars from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Turnos. - */ + public function getHorarioescolarsJoinHorarioescolartipo($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1195,10 +763,7 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelectJoinHorarioescolartipo($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(HorarioescolarPeer::FK_TURNOS_ID, $this->getId()); if (!isset($this->lastHorarioescolarCriteria) || !$this->lastHorarioescolarCriteria->equals($criteria)) { @@ -1211,21 +776,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Turnos is new, it will return - * an empty collection; or if this Turnos has previously - * been saved, it will retrieve related Horarioescolars from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Turnos. - */ + public function getHorarioescolarsJoinEstablecimiento($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseHorarioescolarPeer.php'; + include_once 'lib/model/om/BaseHorarioescolarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1244,10 +798,7 @@ $this->collHorarioescolars = HorarioescolarPeer::doSelectJoinEstablecimiento($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(HorarioescolarPeer::FK_TURNOS_ID, $this->getId()); if (!isset($this->lastHorarioescolarCriteria) || !$this->lastHorarioescolarCriteria->equals($criteria)) { @@ -1259,4 +810,4 @@ return $this->collHorarioescolars; } -} // BaseTurnos +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseTurnosPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseTurnosPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseTurnosPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,60 +1,44 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by TurnosPeer::getOMClass() -include_once 'model/Turnos.php'; -/** - * Base static class for performing query and update operations on the 'turnos' table. - * - * - * - * @package model.om - */ abstract class BaseTurnosPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'turnos'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Turnos'; + + const CLASS_DEFAULT = 'lib.model.Turnos'; - /** The total number of columns. */ + const NUM_COLUMNS = 5; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'turnos.ID'; - /** the column name for the FK_CICLOLECTIVO_ID field */ + const FK_CICLOLECTIVO_ID = 'turnos.FK_CICLOLECTIVO_ID'; - /** the column name for the HORA_INICIO field */ + const HORA_INICIO = 'turnos.HORA_INICIO'; - /** the column name for the HORA_FIN field */ + const HORA_FIN = 'turnos.HORA_FIN'; - /** the column name for the DESCRIPCION field */ + const DESCRIPCION = 'turnos.DESCRIPCION'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'FkCiclolectivoId', 'HoraInicio', 'HoraFin', 'Descripcion', ), BasePeer::TYPE_COLNAME => array (TurnosPeer::ID, TurnosPeer::FK_CICLOLECTIVO_ID, TurnosPeer::HORA_INICIO, TurnosPeer::HORA_FIN, TurnosPeer::DESCRIPCION, ), @@ -62,12 +46,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkCiclolectivoId' => 1, 'HoraInicio' => 2, 'HoraFin' => 3, 'Descripcion' => 4, ), BasePeer::TYPE_COLNAME => array (TurnosPeer::ID => 0, TurnosPeer::FK_CICLOLECTIVO_ID => 1, TurnosPeer::HORA_INICIO => 2, TurnosPeer::HORA_FIN => 3, TurnosPeer::DESCRIPCION => 4, ), @@ -75,24 +54,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/TurnosMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.TurnosMapBuilder'); + include_once 'lib/model/map/TurnosMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.TurnosMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -106,15 +74,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -125,14 +85,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -142,34 +95,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TurnosPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(TurnosPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -188,29 +120,19 @@ const COUNT = 'COUNT(turnos.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT turnos.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TurnosPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TurnosPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -219,19 +141,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Turnos - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -242,33 +155,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return TurnosPeer::populateObjects(TurnosPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -280,29 +172,18 @@ TurnosPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = TurnosPeer::getOMClass(); + $cls = TurnosPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -312,29 +193,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Ciclolectivo table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinCiclolectivo(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TurnosPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TurnosPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -345,25 +216,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Turnos objects pre-filled with their Ciclolectivo objects. - * - * @return array Array of Turnos objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinCiclolectivo(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -391,46 +254,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getCiclolectivo(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCiclolectivo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addTurnos($obj1); //CHECKME - break; + $temp_obj2->addTurnos($obj1); break; } } if ($newObject) { $obj2->initTurnoss(); - $obj2->addTurnos($obj1); //CHECKME - } + $obj2->addTurnos($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TurnosPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TurnosPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -441,25 +291,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Turnos objects pre-filled with all related objects. - * - * @return array Array of Turnos objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -484,8 +326,7 @@ $obj1->hydrate($rs); - // Add objects for joined Ciclolectivo rows - + $omClass = CiclolectivoPeer::getOMClass(); @@ -496,11 +337,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getCiclolectivo(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getCiclolectivo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addTurnos($obj1); // CHECKME - break; + $temp_obj2->addTurnos($obj1); break; } } @@ -514,41 +353,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return TurnosPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Turnos or Criteria object. - * - * @param mixed $values Criteria or Turnos object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -556,21 +373,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Turnos object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(TurnosPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(TurnosPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -581,15 +392,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Turnos or Criteria object. - * - * @param mixed $values Criteria or Turnos object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -599,37 +402,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(TurnosPeer::ID); $selectCriteria->add(TurnosPeer::ID, $criteria->remove(TurnosPeer::ID), $comparison); - } else { // $values is Turnos object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the turnos table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(TurnosPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -639,17 +430,7 @@ } } - /** - * Method perform a DELETE on the database, given a Turnos or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Turnos object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -657,25 +438,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Turnos) { + $criteria = clone $values; } elseif ($values instanceof Turnos) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(TurnosPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -686,18 +461,7 @@ } } - /** - * Validates all modified columns of given Turnos object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Turnos $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Turnos $obj, $cols = null) { $columns = array(); @@ -732,13 +496,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Turnos - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -755,14 +513,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -780,20 +531,14 @@ return $objs; } -} // BaseTurnosPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseTurnosPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/TurnosMapBuilder.php'; - Propel::registerMapBuilder('model.map.TurnosMapBuilder'); + require_once 'lib/model/map/TurnosMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.TurnosMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaseUsuario.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseUsuario.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseUsuario.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,232 +1,125 @@ <?php -require_once 'propel/om/BaseObject.php'; -require_once 'propel/om/Persistent.php'; - - -include_once 'propel/util/Criteria.php'; - -include_once 'model/UsuarioPeer.php'; - -/** - * Base class that represents a row from the 'usuario' table. - * - * - * - * @package model.om - */ abstract class BaseUsuario extends BaseObject implements Persistent { - /** - * The Peer class. - * Instance provides a convenient way of calling static methods on a class - * that calling code may not be able to identify. - * @var UsuarioPeer - */ + protected static $peer; - /** - * The value for the id field. - * @var int - */ + protected $id; - /** - * The value for the usuario field. - * @var string - */ + protected $usuario = ''; - /** - * The value for the clave field. - * @var string - */ + protected $clave = ''; - /** - * The value for the correo_publico field. - * @var boolean - */ + protected $correo_publico = true; - /** - * The value for the activo field. - * @var boolean - */ + protected $activo = true; - /** - * The value for the fecha_creado field. - * @var int - */ + protected $fecha_creado; - /** - * The value for the fecha_actualizado field. - * @var int - */ + protected $fecha_actualizado; - /** - * The value for the seguridad_pregunta field. - * @var string - */ + protected $seguridad_pregunta; - /** - * The value for the seguridad_respuesta field. - * @var string - */ + protected $seguridad_respuesta; - /** - * The value for the email field. - * @var string - */ + protected $email; - /** - * The value for the fk_establecimiento_id field. - * @var int - */ + protected $fk_establecimiento_id = 0; - /** - * The value for the borrado field. - * @var boolean - */ + protected $borrado = true; - /** - * @var Establecimiento - */ + protected $aEstablecimiento; - /** - * Collection to store aggregation of collRelUsuarioPermisos. - * @var array - */ + protected $collRelUsuarioPermisos; - /** - * The criteria used to select the current contents of collRelUsuarioPermisos. - * @var Criteria - */ + protected $lastRelUsuarioPermisoCriteria = null; - /** - * Collection to store aggregation of collLegajopedagogicos. - * @var array - */ + protected $collLegajopedagogicos; - /** - * The criteria used to select the current contents of collLegajopedagogicos. - * @var Criteria - */ + protected $lastLegajopedagogicoCriteria = null; - /** - * Flag to prevent endless save loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInSave = false; - /** - * Flag to prevent endless validation loop, if this object is referenced - * by another object which falls in this transaction. - * @var boolean - */ + protected $alreadyInValidation = false; - /** - * Get the [id] column value. - * - * @return int - */ + public function getId() { return $this->id; } - /** - * Get the [usuario] column value. - * - * @return string - */ + public function getUsuario() { return $this->usuario; } - /** - * Get the [clave] column value. - * - * @return string - */ + public function getClave() { return $this->clave; } - /** - * Get the [correo_publico] column value. - * - * @return boolean - */ + public function getCorreoPublico() { return $this->correo_publico; } - /** - * Get the [activo] column value. - * - * @return boolean - */ + public function getActivo() { return $this->activo; } - /** - * Get the [optionally formatted] [fecha_creado] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaCreado($format = 'Y-m-d H:i:s') { if ($this->fecha_creado === null || $this->fecha_creado === '') { return null; } elseif (!is_int($this->fecha_creado)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_creado); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_creado] as date/time value: " . var_export($this->fecha_creado, true)); + $ts = strtotime($this->fecha_creado); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_creado] as date/time value: " . var_export($this->fecha_creado, true)); } } else { $ts = $this->fecha_creado; @@ -240,24 +133,15 @@ } } - /** - * Get the [optionally formatted] [fecha_actualizado] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ + public function getFechaActualizado($format = 'Y-m-d H:i:s') { if ($this->fecha_actualizado === null || $this->fecha_actualizado === '') { return null; } elseif (!is_int($this->fecha_actualizado)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->fecha_actualizado); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse value of [fecha_actualizado] as date/time value: " . var_export($this->fecha_actualizado, true)); + $ts = strtotime($this->fecha_actualizado); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_actualizado] as date/time value: " . var_export($this->fecha_actualizado, true)); } } else { $ts = $this->fecha_actualizado; @@ -271,67 +155,42 @@ } } - /** - * Get the [seguridad_pregunta] column value. - * - * @return string - */ + public function getSeguridadPregunta() { return $this->seguridad_pregunta; } - /** - * Get the [seguridad_respuesta] column value. - * - * @return string - */ + public function getSeguridadRespuesta() { return $this->seguridad_respuesta; } - /** - * Get the [email] column value. - * - * @return string - */ + public function getEmail() { return $this->email; } - /** - * Get the [fk_establecimiento_id] column value. - * - * @return int - */ + public function getFkEstablecimientoId() { return $this->fk_establecimiento_id; } - /** - * Get the [borrado] column value. - * - * @return boolean - */ + public function getBorrado() { return $this->borrado; } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return void - */ + public function setId($v) { @@ -340,14 +199,8 @@ $this->modifiedColumns[] = UsuarioPeer::ID; } - } // setId() - - /** - * Set the value of [usuario] column. - * - * @param string $v new value - * @return void - */ + } + public function setUsuario($v) { @@ -356,14 +209,8 @@ $this->modifiedColumns[] = UsuarioPeer::USUARIO; } - } // setUsuario() - - /** - * Set the value of [clave] column. - * - * @param string $v new value - * @return void - */ + } + public function setClave($v) { @@ -372,14 +219,8 @@ $this->modifiedColumns[] = UsuarioPeer::CLAVE; } - } // setClave() - - /** - * Set the value of [correo_publico] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setCorreoPublico($v) { @@ -388,14 +229,8 @@ $this->modifiedColumns[] = UsuarioPeer::CORREO_PUBLICO; } - } // setCorreoPublico() - - /** - * Set the value of [activo] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setActivo($v) { @@ -404,21 +239,14 @@ $this->modifiedColumns[] = UsuarioPeer::ACTIVO; } - } // setActivo() - - /** - * Set the value of [fecha_creado] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaCreado($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_creado] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_creado] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -428,21 +256,14 @@ $this->modifiedColumns[] = UsuarioPeer::FECHA_CREADO; } - } // setFechaCreado() - - /** - * Set the value of [fecha_actualizado] column. - * - * @param int $v new value - * @return void - */ + } + public function setFechaActualizado($v) { if ($v !== null && !is_int($v)) { $ts = strtotime($v); - if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE - throw new PropelException("Unable to parse date/time value for [fecha_actualizado] from input: " . var_export($v, true)); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_actualizado] from input: " . var_export($v, true)); } } else { $ts = $v; @@ -452,14 +273,8 @@ $this->modifiedColumns[] = UsuarioPeer::FECHA_ACTUALIZADO; } - } // setFechaActualizado() - - /** - * Set the value of [seguridad_pregunta] column. - * - * @param string $v new value - * @return void - */ + } + public function setSeguridadPregunta($v) { @@ -468,14 +283,8 @@ $this->modifiedColumns[] = UsuarioPeer::SEGURIDAD_PREGUNTA; } - } // setSeguridadPregunta() - - /** - * Set the value of [seguridad_respuesta] column. - * - * @param string $v new value - * @return void - */ + } + public function setSeguridadRespuesta($v) { @@ -484,14 +293,8 @@ $this->modifiedColumns[] = UsuarioPeer::SEGURIDAD_RESPUESTA; } - } // setSeguridadRespuesta() - - /** - * Set the value of [email] column. - * - * @param string $v new value - * @return void - */ + } + public function setEmail($v) { @@ -500,14 +303,8 @@ $this->modifiedColumns[] = UsuarioPeer::EMAIL; } - } // setEmail() - - /** - * Set the value of [fk_establecimiento_id] column. - * - * @param int $v new value - * @return void - */ + } + public function setFkEstablecimientoId($v) { @@ -520,14 +317,8 @@ $this->aEstablecimiento = null; } - } // setFkEstablecimientoId() - - /** - * Set the value of [borrado] column. - * - * @param boolean $v new value - * @return void - */ + } + public function setBorrado($v) { @@ -536,21 +327,8 @@ $this->modifiedColumns[] = UsuarioPeer::BORRADO; } - } // setBorrado() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ + } + public function hydrate(ResultSet $rs, $startcol = 1) { try { @@ -583,23 +361,13 @@ $this->setNew(false); - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 12; // 12 = UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS). - + return $startcol + 12; } catch (Exception $e) { throw new PropelException("Error populating Usuario object", $e); } } - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ + public function delete($con = null) { if ($this->isDeleted()) { @@ -621,16 +389,7 @@ } } - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ + public function save($con = null) { if ($this->isDeleted()) { @@ -652,29 +411,14 @@ } } - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ + protected function doSave($con) { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { + $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if ($this->aEstablecimiento->isModified()) { $affectedRows += $this->aEstablecimiento->save($con); @@ -683,22 +427,16 @@ } - // If this object has been modified, then save it to the database. - if ($this->isModified()) { + if ($this->isModified()) { if ($this->isNew()) { $pk = UsuarioPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setId($pk); //[IMV] update autoincrement primary key - + $affectedRows += 1; + $this->setId($pk); $this->setNew(false); } else { $affectedRows += UsuarioPeer::doUpdate($this, $con); } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } + $this->resetModified(); } if ($this->collRelUsuarioPermisos !== null) { foreach($this->collRelUsuarioPermisos as $referrerFK) { @@ -719,37 +457,17 @@ $this->alreadyInSave = false; } return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ + } + protected $validationFailures = array(); - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ + public function getValidationFailures() { return $this->validationFailures; } - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ + public function validate($columns = null) { $res = $this->doValidate($columns); @@ -762,16 +480,7 @@ } } - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then <code>true</code> is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. - */ + protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { @@ -781,11 +490,7 @@ $failureMap = array(); - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - + if ($this->aEstablecimiento !== null) { if (!$this->aEstablecimiento->validate($columns)) { $failureMap = array_merge($failureMap, $this->aEstablecimiento->getValidationFailures()); @@ -821,28 +526,14 @@ return (!empty($failureMap) ? $failureMap : true); } - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = UsuarioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->getByPosition($pos); } - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ + public function getByPosition($pos) { switch($pos) { @@ -885,19 +576,9 @@ default: return null; break; - } // switch() - } + } } - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = UsuarioPeer::getFieldNames($keyType); @@ -918,30 +599,14 @@ return $result; } - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = UsuarioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ + public function setByPosition($pos, $value) { switch($pos) { @@ -981,25 +646,9 @@ case 11: $this->setBorrado($value); break; - } // switch() - } + } } - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, - * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = UsuarioPeer::getFieldNames($keyType); @@ -1018,11 +667,7 @@ if (array_key_exists($keys[11], $arr)) $this->setBorrado($arr[$keys[11]]); } - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ + public function buildCriteria() { $criteria = new Criteria(UsuarioPeer::DATABASE_NAME); @@ -1043,14 +688,7 @@ return $criteria; } - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ + public function buildPkeyCriteria() { $criteria = new Criteria(UsuarioPeer::DATABASE_NAME); @@ -1060,36 +698,19 @@ return $criteria; } - /** - * Returns the primary key for this object (row). - * @return int - */ + public function getPrimaryKey() { return $this->getId(); } - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ + public function setPrimaryKey($key) { $this->setId($key); } - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Usuario (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ + public function copyInto($copyObj, $deepCopy = false) { @@ -1117,9 +738,7 @@ if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); + $copyObj->setNew(false); foreach($this->getRelUsuarioPermisos() as $relObj) { $copyObj->addRelUsuarioPermiso($relObj->copy($deepCopy)); @@ -1129,45 +748,23 @@ $copyObj->addLegajopedagogico($relObj->copy($deepCopy)); } - } // if ($deepCopy) + } - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a pkey column, so set to default value - + $copyObj->setId(NULL); } - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Usuario Clone of current object. - * @throws PropelException - */ + public function copy($deepCopy = false) { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); + $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return UsuarioPeer - */ + public function getPeer() { if (self::$peer === null) { @@ -1176,13 +773,7 @@ return self::$peer; } - /** - * Declares an association between this object and a Establecimiento object. - * - * @param Establecimiento $v - * @return void - * @throws PropelException - */ + public function setEstablecimiento($v) { @@ -1198,41 +789,21 @@ } - /** - * Get the associated Establecimiento object - * - * @param Connection Optional Connection object. - * @return Establecimiento The associated Establecimiento object. - * @throws PropelException - */ + public function getEstablecimiento($con = null) { - // include the related Peer class - include_once 'model/om/BaseEstablecimientoPeer.php'; + include_once 'lib/model/om/BaseEstablecimientoPeer.php'; if ($this->aEstablecimiento === null && ($this->fk_establecimiento_id !== null)) { $this->aEstablecimiento = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - /* The following can be used instead of the line above to - guarantee the related object contains a reference - to this object, but this level of coupling - may be undesirable in many circumstances. - As it can lead to a db query with many results that may - never be used. - $obj = EstablecimientoPeer::retrieveByPK($this->fk_establecimiento_id, $con); - $obj->addEstablecimientos($this); - */ + } return $this->aEstablecimiento; } - /** - * Temporary storage of collRelUsuarioPermisos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initRelUsuarioPermisos() { if ($this->collRelUsuarioPermisos === null) { @@ -1240,23 +811,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Usuario has previously - * been saved, it will retrieve related RelUsuarioPermisos from storage. - * If this Usuario is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getRelUsuarioPermisos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + include_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1276,13 +834,9 @@ $this->collRelUsuarioPermisos = RelUsuarioPermisoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(RelUsuarioPermisoPeer::FK_USUARIO_ID, $this->getId()); RelUsuarioPermisoPeer::addSelectColumns($criteria); @@ -1295,18 +849,10 @@ return $this->collRelUsuarioPermisos; } - /** - * Returns the number of related RelUsuarioPermisos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countRelUsuarioPermisos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + include_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1320,14 +866,7 @@ return RelUsuarioPermisoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a RelUsuarioPermiso object to this object - * through the RelUsuarioPermiso foreign key attribute - * - * @param RelUsuarioPermiso $l RelUsuarioPermiso - * @return void - * @throws PropelException - */ + public function addRelUsuarioPermiso(RelUsuarioPermiso $l) { $this->collRelUsuarioPermisos[] = $l; @@ -1335,21 +874,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Usuario is new, it will return - * an empty collection; or if this Usuario has previously - * been saved, it will retrieve related RelUsuarioPermisos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Usuario. - */ + public function getRelUsuarioPermisosJoinPermiso($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseRelUsuarioPermisoPeer.php'; + include_once 'lib/model/om/BaseRelUsuarioPermisoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1368,10 +896,7 @@ $this->collRelUsuarioPermisos = RelUsuarioPermisoPeer::doSelectJoinPermiso($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(RelUsuarioPermisoPeer::FK_USUARIO_ID, $this->getId()); if (!isset($this->lastRelUsuarioPermisoCriteria) || !$this->lastRelUsuarioPermisoCriteria->equals($criteria)) { @@ -1383,12 +908,7 @@ return $this->collRelUsuarioPermisos; } - /** - * Temporary storage of collLegajopedagogicos to save a possible db hit in - * the event objects are add to the collection, but the - * complete collection is never requested. - * @return void - */ + public function initLegajopedagogicos() { if ($this->collLegajopedagogicos === null) { @@ -1396,23 +916,10 @@ } } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Usuario has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * If this Usuario is new, it will return - * an empty collection or the current collection, the criteria - * is ignored on a new object. - * - * @param Connection $con - * @param Criteria $criteria - * @throws PropelException - */ + public function getLegajopedagogicos($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1432,13 +939,9 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelect($criteria, $con); } } else { - // criteria has no effect for a new object - if (!$this->isNew()) { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. + if (!$this->isNew()) { + - $criteria->add(LegajopedagogicoPeer::FK_USUARIO_ID, $this->getId()); LegajopedagogicoPeer::addSelectColumns($criteria); @@ -1451,18 +954,10 @@ return $this->collLegajopedagogicos; } - /** - * Returns the number of related Legajopedagogicos. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param Connection $con - * @throws PropelException - */ + public function countLegajopedagogicos($criteria = null, $distinct = false, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1476,14 +971,7 @@ return LegajopedagogicoPeer::doCount($criteria, $distinct, $con); } - /** - * Method called to associate a Legajopedagogico object to this object - * through the Legajopedagogico foreign key attribute - * - * @param Legajopedagogico $l Legajopedagogico - * @return void - * @throws PropelException - */ + public function addLegajopedagogico(Legajopedagogico $l) { $this->collLegajopedagogicos[] = $l; @@ -1491,21 +979,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Usuario is new, it will return - * an empty collection; or if this Usuario has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Usuario. - */ + public function getLegajopedagogicosJoinLegajocategoria($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1524,10 +1001,7 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelectJoinLegajocategoria($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajopedagogicoPeer::FK_USUARIO_ID, $this->getId()); if (!isset($this->lastLegajopedagogicoCriteria) || !$this->lastLegajopedagogicoCriteria->equals($criteria)) { @@ -1540,21 +1014,10 @@ } - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Usuario is new, it will return - * an empty collection; or if this Usuario has previously - * been saved, it will retrieve related Legajopedagogicos from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Usuario. - */ + public function getLegajopedagogicosJoinAlumno($criteria = null, $con = null) { - // include the Peer class - include_once 'model/om/BaseLegajopedagogicoPeer.php'; + include_once 'lib/model/om/BaseLegajopedagogicoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } @@ -1573,10 +1036,7 @@ $this->collLegajopedagogicos = LegajopedagogicoPeer::doSelectJoinAlumno($criteria, $con); } } else { - // the following code is to determine if a new query is - // called for. If the criteria is the same as the last - // one, just return the collection. - + $criteria->add(LegajopedagogicoPeer::FK_USUARIO_ID, $this->getId()); if (!isset($this->lastLegajopedagogicoCriteria) || !$this->lastLegajopedagogicoCriteria->equals($criteria)) { @@ -1588,4 +1048,4 @@ return $this->collLegajopedagogicos; } -} // BaseUsuario +} \ No newline at end of file Modified: prosistem/alba/trunk/alba/lib/model/om/BaseUsuarioPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseUsuarioPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaseUsuarioPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,81 +1,65 @@ <?php -require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by UsuarioPeer::getOMClass() -include_once 'model/Usuario.php'; -/** - * Base static class for performing query and update operations on the 'usuario' table. - * - * - * - * @package model.om - */ abstract class BaseUsuarioPeer { - /** the default database name for this class */ + const DATABASE_NAME = 'alba'; - /** the table name for this class */ + const TABLE_NAME = 'usuario'; - /** A class that can be returned by this peer. */ - const CLASS_DEFAULT = 'model.Usuario'; + + const CLASS_DEFAULT = 'lib.model.Usuario'; - /** The total number of columns. */ + const NUM_COLUMNS = 12; - /** The number of lazy-loaded columns. */ + const NUM_LAZY_LOAD_COLUMNS = 0; - /** the column name for the ID field */ + const ID = 'usuario.ID'; - /** the column name for the USUARIO field */ + const USUARIO = 'usuario.USUARIO'; - /** the column name for the CLAVE field */ + const CLAVE = 'usuario.CLAVE'; - /** the column name for the CORREO_PUBLICO field */ + const CORREO_PUBLICO = 'usuario.CORREO_PUBLICO'; - /** the column name for the ACTIVO field */ + const ACTIVO = 'usuario.ACTIVO'; - /** the column name for the FECHA_CREADO field */ + const FECHA_CREADO = 'usuario.FECHA_CREADO'; - /** the column name for the FECHA_ACTUALIZADO field */ + const FECHA_ACTUALIZADO = 'usuario.FECHA_ACTUALIZADO'; - /** the column name for the SEGURIDAD_PREGUNTA field */ + const SEGURIDAD_PREGUNTA = 'usuario.SEGURIDAD_PREGUNTA'; - /** the column name for the SEGURIDAD_RESPUESTA field */ + const SEGURIDAD_RESPUESTA = 'usuario.SEGURIDAD_RESPUESTA'; - /** the column name for the EMAIL field */ + const EMAIL = 'usuario.EMAIL'; - /** the column name for the FK_ESTABLECIMIENTO_ID field */ + const FK_ESTABLECIMIENTO_ID = 'usuario.FK_ESTABLECIMIENTO_ID'; - /** the column name for the BORRADO field */ + const BORRADO = 'usuario.BORRADO'; - /** The PHP to DB Name Mapping */ + private static $phpNameMap = null; - /** - * holds an array of fieldnames - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' - */ + private static $fieldNames = array ( BasePeer::TYPE_PHPNAME => array ('Id', 'Usuario', 'Clave', 'CorreoPublico', 'Activo', 'FechaCreado', 'FechaActualizado', 'SeguridadPregunta', 'SeguridadRespuesta', 'Email', 'FkEstablecimientoId', 'Borrado', ), BasePeer::TYPE_COLNAME => array (UsuarioPeer::ID, UsuarioPeer::USUARIO, UsuarioPeer::CLAVE, UsuarioPeer::CORREO_PUBLICO, UsuarioPeer::ACTIVO, UsuarioPeer::FECHA_CREADO, UsuarioPeer::FECHA_ACTUALIZADO, UsuarioPeer::SEGURIDAD_PREGUNTA, UsuarioPeer::SEGURIDAD_RESPUESTA, UsuarioPeer::EMAIL, UsuarioPeer::FK_ESTABLECIMIENTO_ID, UsuarioPeer::BORRADO, ), @@ -83,12 +67,7 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ + private static $fieldKeys = array ( BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Usuario' => 1, 'Clave' => 2, 'CorreoPublico' => 3, 'Activo' => 4, 'FechaCreado' => 5, 'FechaActualizado' => 6, 'SeguridadPregunta' => 7, 'SeguridadRespuesta' => 8, 'Email' => 9, 'FkEstablecimientoId' => 10, 'Borrado' => 11, ), BasePeer::TYPE_COLNAME => array (UsuarioPeer::ID => 0, UsuarioPeer::USUARIO => 1, UsuarioPeer::CLAVE => 2, UsuarioPeer::CORREO_PUBLICO => 3, UsuarioPeer::ACTIVO => 4, UsuarioPeer::FECHA_CREADO => 5, UsuarioPeer::FECHA_ACTUALIZADO => 6, UsuarioPeer::SEGURIDAD_PREGUNTA => 7, UsuarioPeer::SEGURIDAD_RESPUESTA => 8, UsuarioPeer::EMAIL => 9, UsuarioPeer::FK_ESTABLECIMIENTO_ID => 10, UsuarioPeer::BORRADO => 11, ), @@ -96,24 +75,13 @@ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getMapBuilder() { - include_once 'model/map/UsuarioMapBuilder.php'; - return BasePeer::getMapBuilder('model.map.UsuarioMapBuilder'); + include_once 'lib/model/map/UsuarioMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.UsuarioMapBuilder'); } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ + public static function getPhpNameMap() { if (self::$phpNameMap === null) { @@ -127,15 +95,7 @@ } return self::$phpNameMap; } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ + static public function translateFieldName($name, $fromType, $toType) { $toNames = self::getFieldNames($toType); @@ -146,14 +106,7 @@ return $toNames[$key]; } - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) { @@ -163,34 +116,13 @@ return self::$fieldNames[$type]; } - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * <code> - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * </code> - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. UsuarioPeer::COLUMN_NAME). - * @return string - */ + public static function alias($alias, $column) { return str_replace(UsuarioPeer::TABLE_NAME.'.', $alias.'.', $column); } - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function addSelectColumns(Criteria $criteria) { @@ -223,29 +155,19 @@ const COUNT = 'COUNT(usuario.ID)'; const COUNT_DISTINCT = 'COUNT(DISTINCT usuario.ID)'; - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(UsuarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(UsuarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -254,19 +176,10 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Usuario - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectOne(Criteria $criteria, $con = null) { $critcopy = clone $criteria; @@ -277,33 +190,12 @@ } return null; } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelect(Criteria $criteria, $con = null) { return UsuarioPeer::populateObjects(UsuarioPeer::doSelectRS($criteria, $con)); } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ + public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { @@ -315,29 +207,18 @@ UsuarioPeer::addSelectColumns($criteria); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); + return BasePeer::doSelect($criteria, $con); } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function populateObjects(ResultSet $rs) { $results = array(); - // set the class once to avoid overhead in the loop - $cls = UsuarioPeer::getOMClass(); + $cls = UsuarioPeer::getOMClass(); $cls = Propel::import($cls); - // populate the object(s) - while($rs->next()) { + while($rs->next()) { $obj = new $cls(); $obj->hydrate($rs); @@ -347,29 +228,19 @@ return $results; } - /** - * Returns the number of rows matching criteria, joining the related Establecimiento table - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinEstablecimiento(Criteria $criteria, $distinct = false, $con = null) { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; + $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(UsuarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(UsuarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -380,25 +251,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Usuario objects pre-filled with their Establecimiento objects. - * - * @return array Array of Usuario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinEstablecimiento(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -426,46 +289,33 @@ $newObject = true; foreach($results as $temp_obj1) { - $temp_obj2 = $temp_obj1->getEstablecimiento(); //CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - // e.g. $author->addBookRelatedByBookId() - $temp_obj2->addUsuario($obj1); //CHECKME - break; + $temp_obj2->addUsuario($obj1); break; } } if ($newObject) { $obj2->initUsuarios(); - $obj2->addUsuario($obj1); //CHECKME - } + $obj2->addUsuario($obj1); } $results[] = $obj1; } return $results; } - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $c - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); + $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(UsuarioPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(UsuarioPeer::COUNT); } - // just in case we're grouping: add those columns to the select statement - foreach($criteria->getGroupByColumns() as $column) + foreach($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } @@ -476,25 +326,17 @@ if ($rs->next()) { return $rs->getInt(1); } else { - // no rows returned; we infer that means 0 matches. - return 0; + return 0; } } - /** - * Selects a collection of Usuario objects pre-filled with all related objects. - * - * @return array Array of Usuario objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; - // Set the correct dbName if it has not been overridden - if ($c->getDbName() == Propel::getDefaultDB()) { + if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } @@ -519,8 +361,7 @@ $obj1->hydrate($rs); - // Add objects for joined Establecimiento rows - + $omClass = EstablecimientoPeer::getOMClass(); @@ -531,11 +372,9 @@ $newObject = true; for ($j=0, $resCount=count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; - $temp_obj2 = $temp_obj1->getEstablecimiento(); // CHECKME - if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $temp_obj2 = $temp_obj1->getEstablecimiento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; - $temp_obj2->addUsuario($obj1); // CHECKME - break; + $temp_obj2->addUsuario($obj1); break; } } @@ -549,41 +388,19 @@ return $results; } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function getTableMap() { return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); } - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ + public static function getOMClass() { return UsuarioPeer::CLASS_DEFAULT; } - /** - * Method perform an INSERT on the database, given a Usuario or Criteria object. - * - * @param mixed $values Criteria or Usuario object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doInsert($values, $con = null) { if ($con === null) { @@ -591,21 +408,15 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Usuario object - } + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } - $criteria->remove(UsuarioPeer::ID); // remove pkey col since this table uses auto-increment + $criteria->remove(UsuarioPeer::ID); + $criteria->setDbName(self::DATABASE_NAME); - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); + $con->begin(); $pk = BasePeer::doInsert($criteria, $con); $con->commit(); } catch(PropelException $e) { @@ -616,15 +427,7 @@ return $pk; } - /** - * Method perform an UPDATE on the database, given a Usuario or Criteria object. - * - * @param mixed $values Criteria or Usuario object containing data that is used to create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doUpdate($values, $con = null) { if ($con === null) { @@ -634,37 +437,25 @@ $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - + $criteria = clone $values; $comparison = $criteria->getComparison(UsuarioPeer::ID); $selectCriteria->add(UsuarioPeer::ID, $criteria->remove(UsuarioPeer::ID), $comparison); - } else { // $values is Usuario object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } + } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); } - /** - * Method to DELETE all rows from the usuario table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ + public static function doDeleteAll($con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $affectedRows = 0; try { + $con->begin(); $affectedRows += BasePeer::doDeleteAll(UsuarioPeer::TABLE_NAME, $con); $con->commit(); return $affectedRows; @@ -674,17 +465,7 @@ } } - /** - * Method perform a DELETE on the database, given a Usuario or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Usuario object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function doDelete($values, $con = null) { if ($con === null) { @@ -692,25 +473,19 @@ } if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Usuario) { + $criteria = clone $values; } elseif ($values instanceof Usuario) { $criteria = $values->buildPkeyCriteria(); } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); + $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(UsuarioPeer::ID, (array) $values, Criteria::IN); } - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); + $criteria->setDbName(self::DATABASE_NAME); - $affectedRows = 0; // initialize var to track total num of affected rows - + $affectedRows = 0; try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); + $con->begin(); $affectedRows += BasePeer::doDelete($criteria, $con); $con->commit(); @@ -721,18 +496,7 @@ } } - /** - * Validates all modified columns of given Usuario object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Usuario $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ + public static function doValidate(Usuario $obj, $cols = null) { $columns = array(); @@ -767,13 +531,7 @@ return $res; } - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Usuario - */ + public static function retrieveByPK($pk, $con = null) { if ($con === null) { @@ -790,14 +548,7 @@ return !empty($v) > 0 ? $v[0] : null; } - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ + public static function retrieveByPKs($pks, $con = null) { if ($con === null) { @@ -815,20 +566,14 @@ return $objs; } -} // BaseUsuarioPeer - -// static code to register the map builder for this Peer with the main Propel class +} if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { + try { BaseUsuarioPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'model/map/UsuarioMapBuilder.php'; - Propel::registerMapBuilder('model.map.UsuarioMapBuilder'); + require_once 'lib/model/map/UsuarioMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.UsuarioMapBuilder'); } Modified: prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividad.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividad.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividad.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -7,7 +7,7 @@ include_once 'propel/util/Criteria.php'; -include_once 'model/relAnioActividadPeer.php'; +include_once 'lib/model/relAnioActividadPeer.php'; /** * Base class that represents a row from the 'rel_anio_actividad' table. @@ -680,7 +680,7 @@ public function getActividad($con = null) { // include the related Peer class - include_once 'model/om/BaseActividadPeer.php'; + include_once 'lib/model/om/BaseActividadPeer.php'; if ($this->aActividad === null && ($this->fk_actividad_id !== null)) { @@ -731,7 +731,7 @@ public function getAnio($con = null) { // include the related Peer class - include_once 'model/om/BaseAnioPeer.php'; + include_once 'lib/model/om/BaseAnioPeer.php'; if ($this->aAnio === null && ($this->fk_anio_id !== null)) { Modified: prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividadPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividadPeer.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/model/om/BaserelAnioActividadPeer.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -3,7 +3,7 @@ require_once 'propel/util/BasePeer.php'; // The object class -- needed for instanceof checks in this class. // actual class may be a subclass -- as returned by relAnioActividadPeer::getOMClass() -include_once 'model/relAnioActividad.php'; +include_once 'lib/model/relAnioActividad.php'; /** * Base static class for performing query and update operations on the 'rel_anio_actividad' table. @@ -76,7 +76,7 @@ */ public static function getMapBuilder() { - include_once 'model/map/relAnioActividadMapBuilder.php'; + include_once 'lib/model/map/relAnioActividadMapBuilder.php'; return BasePeer::getMapBuilder('model.map.relAnioActividadMapBuilder'); } /** @@ -1086,6 +1086,6 @@ } else { // even if Propel is not yet initialized, the map builder class can be registered // now and then it will be loaded when Propel initializes. - require_once 'model/map/relAnioActividadMapBuilder.php'; + require_once 'lib/model/map/relAnioActividadMapBuilder.php'; Propel::registerMapBuilder('model.map.relAnioActividadMapBuilder'); } Deleted: prosistem/alba/trunk/alba/lib/pake =================================================================== --- prosistem/alba/trunk/alba/lib/pake 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/pake 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +0,0 @@ -link ../../dist/symfony/lib/vendor/pake \ No newline at end of file Deleted: prosistem/alba/trunk/alba/lib/phing =================================================================== --- prosistem/alba/trunk/alba/lib/phing 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/lib/phing 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +0,0 @@ -link ../../dist/symfony/lib/vendor/phing/ \ No newline at end of file Added: prosistem/alba/trunk/alba/symfony =================================================================== --- prosistem/alba/trunk/alba/symfony 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/symfony 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,14 @@ +#!/usr/bin/env php +<?php + +/* + * This file is part of the symfony package. + * (c) 2004-2006 Fabien Potencier <[email protected]> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +chdir(dirname(__FILE__)); +include('config/config.php'); +include($sf_symfony_data_dir.'/bin/symfony.php'); Property changes on: prosistem/alba/trunk/alba/symfony ___________________________________________________________________ Name: svn:executable + * Added: prosistem/alba/trunk/alba/symfony.bat =================================================================== --- prosistem/alba/trunk/alba/symfony.bat 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/symfony.bat 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,39 @@ +@echo off + +rem ************************************************************* +rem ** symfony CLI for Windows based systems (based on phing.bat) +rem ************************************************************* + +rem This script will do the following: +rem - check for PHP_COMMAND env, if found, use it. +rem - if not found detect php, if found use it, otherwise err and terminate + +if "%OS%"=="Windows_NT" @setlocal + +rem %~dp0 is expanded pathname of the current script under NT +set SCRIPT_DIR=%~dp0 + +goto init + +:init + +if "%PHP_COMMAND%" == "" goto no_phpcommand + +IF EXIST ".\symfony" ( + %PHP_COMMAND% -d html_errors=off -d open_basedir= -q ".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 +) ELSE ( + %PHP_COMMAND% -d html_errors=off -d open_basedir= -q "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 +) +goto cleanup + +:no_phpcommand +rem echo ------------------------------------------------------------------------ +rem echo WARNING: Set environment var PHP_COMMAND to the location of your php.exe +rem echo executable (e.g. C:\PHP\php.exe). (assuming php.exe on PATH) +rem echo ------------------------------------------------------------------------ +set PHP_COMMAND=php.exe +goto init + +:cleanup +if "%OS%"=="Windows_NT" @endlocal +rem pause Added: prosistem/alba/trunk/alba/symfony.php =================================================================== --- prosistem/alba/trunk/alba/symfony.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/symfony.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,173 @@ +<?php + +/* + * This file is part of the symfony package. + * (c) 2004-2006 Fabien Potencier <[email protected]> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (!isset($sf_symfony_lib_dir)) +{ + die("You must launch symfony command line with the symfony script\n"); +} + +if (ini_get('zend.ze1_compatibility_mode')) +{ + die("symfony cannot run with zend.ze1_compatibility_mode enabled.\nPlease turn zend.ze1_compatibility_mode to Off in your php.ini.\n"); +} + +// check if we are using an old project +if (file_exists('config/config.php') && !isset($sf_symfony_lib_dir)) +{ + // allow only upgrading + if (!in_array('upgrade', $argv)) + { + echo "Please upgrade your project before launching any other symfony task\n"; + exit(); + } +} + +require_once($sf_symfony_lib_dir.'/vendor/pake/pakeFunction.php'); +require_once($sf_symfony_lib_dir.'/vendor/pake/pakeGetopt.class.php'); + +// autoloading for pake tasks +class simpleAutoloader +{ + static public + $class_paths = array(), + $autoload_callables = array(); + + static public function initialize($sf_symfony_lib_dir) + { + self::$class_paths = array(); + + self::register($sf_symfony_lib_dir, '.class.php'); + self::register($sf_symfony_lib_dir.'/vendor/propel', '.php'); + self::register($sf_symfony_lib_dir.'/vendor/creole', '.php'); + self::register('lib/model', '.php'); + self::register('plugins', '.php'); + } + + static public function __autoload($class) + { + if (!isset(self::$class_paths[$class])) + { + foreach ((array) self::$autoload_callables as $callable) + { + if (call_user_func($callable, $class)) + { + return true; + } + } + + return false; + } + + require_once(self::$class_paths[$class]); + + return true; + } + + static public function register($dir, $ext) + { + if (!is_dir($dir)) + { + return; + } + + foreach (pakeFinder::type('file')->name('*'.$ext)->ignore_version_control()->follow_link()->in($dir) as $file) + { + self::$class_paths[str_replace($ext, '', str_replace('.class', '', basename($file, $ext)))] = $file; + } + } + + static public function add($class, $file) + { + if (!is_file($file)) + { + return; + } + + self::$class_paths[$class] = $file; + } + + static public function registerCallable($callable) + { + if (!is_callable($callable)) + { + throw new Exception('Autoload callable does not exist'); + } + + self::$autoload_callables[] = $callable; + } +} + +function __autoload($class) +{ + static $initialized = false; + + if (!$initialized) + { + simpleAutoloader::initialize(sfConfig::get('sf_symfony_lib_dir')); + $initialized = true; + } + + return simpleAutoloader::__autoload($class); +} + +// trap -V before pake +if (in_array('-V', $argv) || in_array('--version', $argv)) +{ + printf("symfony version %s\n", pakeColor::colorize(trim(file_get_contents($sf_symfony_lib_dir.'/VERSION')), 'INFO')); + exit(0); +} + +if (count($argv) <= 1) +{ + $argv[] = '-T'; +} + +require_once($sf_symfony_lib_dir.'/config/sfConfig.class.php'); + +sfConfig::add(array( + 'sf_root_dir' => getcwd(), + 'sf_symfony_lib_dir' => $sf_symfony_lib_dir, + 'sf_symfony_data_dir' => $sf_symfony_data_dir, +)); + +// directory layout +include($sf_symfony_data_dir.'/config/constants.php'); + +// include path +set_include_path( + sfConfig::get('sf_lib_dir').PATH_SEPARATOR. + sfConfig::get('sf_app_lib_dir').PATH_SEPARATOR. + sfConfig::get('sf_model_dir').PATH_SEPARATOR. + sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'vendor'.PATH_SEPARATOR. + get_include_path() +); + +// register tasks +$dirs = array( + sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'tasks' => 'myPake*.php', // project tasks + sfConfig::get('sf_symfony_data_dir').DIRECTORY_SEPARATOR.'tasks' => 'sfPake*.php', // symfony tasks + sfConfig::get('sf_root_dir').'/plugins/*/data/tasks' => '*.php', // plugin tasks +); +foreach ($dirs as $globDir => $name) +{ + if ($dirs = glob($globDir)) + { + $tasks = pakeFinder::type('file')->name($name)->in($dirs); + foreach ($tasks as $task) + { + include_once($task); + } + } +} + +// run task +pakeApp::get_instance()->run(null, null, false); + +exit(0); Property changes on: prosistem/alba/trunk/alba/symfony.php ___________________________________________________________________ Name: svn:keywords + Id Date Author Rev URL Deleted: prosistem/alba/trunk/alba/symfony.sh =================================================================== --- prosistem/alba/trunk/alba/symfony.sh 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/symfony.sh 2007-02-28 20:20:23 UTC (rev 4346) @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Shell wrapper for symfony (based on Phing shell wrapper) -# $Id: symfony.sh 500 2006-01-23 09:15:57Z fabien $ -# -# This script will do the following: -# - check for PHP_COMMAND env, if found, use it. -# - if not found assume php is on the path -# - check for SYMFONY_HOME env, if found use it -# - if not look for it -# - check for PHP_CLASSPATH, if found use it -# - if not found set it using SYMFONY_HOME/lib - -if [ -z "$SYMFONY_HOME" ] ; then - SYMFONY_HOME="bin" -fi - -if (test -z "$PHP_COMMAND") ; then - # echo "WARNING: PHP_COMMAND environment not set. (Assuming php on PATH)" - export PHP_COMMAND=php -fi - -if (test -z "$PHP_CLASSPATH") ; then - PHP_CLASSPATH=$SYMFONY_HOME/lib - export PHP_CLASSPATH -fi - -$PHP_COMMAND -d html_errors=off -qC $SYMFONY_HOME/symfony.php $* Added: prosistem/alba/trunk/alba/test/bootstrap/functional.php =================================================================== --- prosistem/alba/trunk/alba/test/bootstrap/functional.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/test/bootstrap/functional.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,29 @@ +<?php + +/* + * This file is part of the symfony package. + * (c) 2004-2006 Fabien Potencier <[email protected]> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +// guess current application +if (!isset($app)) +{ + $traces = debug_backtrace(); + $caller = $traces[0]; + $app = array_pop(explode(DIRECTORY_SEPARATOR, dirname($caller['file']))); +} + +// define symfony constant +define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/../..')); +define('SF_APP', $app); +define('SF_ENVIRONMENT', 'test'); +define('SF_DEBUG', true); + +// initialize symfony +require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); + +// remove all cache +sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir')); Property changes on: prosistem/alba/trunk/alba/test/bootstrap/functional.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Added: prosistem/alba/trunk/alba/test/bootstrap/unit.php =================================================================== --- prosistem/alba/trunk/alba/test/bootstrap/unit.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/test/bootstrap/unit.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,17 @@ +<?php + +/* + * This file is part of the symfony package. + * (c) 2004-2006 Fabien Potencier <[email protected]> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +$_test_dir = realpath(dirname(__FILE__).'/..'); +define('SF_ROOT_DIR', realpath($_test_dir.'/..')); + +// symfony directories +include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); + +require_once($sf_symfony_lib_dir.'/vendor/lime/lime.php'); Property changes on: prosistem/alba/trunk/alba/test/bootstrap/unit.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Modified: prosistem/alba/trunk/alba/web/css/main.css =================================================================== --- prosistem/alba/trunk/alba/web/css/main.css 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/web/css/main.css 2007-02-28 20:20:23 UTC (rev 4346) @@ -58,4 +58,30 @@ background: url(../images/small/ir_a.png) no-repeat 3px 2px; border-right: 4px solid #73B65A !important; } - \ No newline at end of file + +.form-errors +{ + margin-bottom: 10px; + border: 1px solid #f33; + background-color: #ffc; +} + +.form-errors h2 +{ + padding: 5px 20px 5px 25px; + font-size: 11px; + color: #fff; + background: #f33 url(/sf/images/sf_admin/error.png) no-repeat 5px 2px; +} + +.form-errors ul +{ + padding: 5px; + list-style-type: none; +} + +.form-errors li +{ + padding: 5px 20px; + background: url(/sf/images/sf_admin/error.png) no-repeat 0 2px; +} Added: prosistem/alba/trunk/alba/web/errors/error500.php =================================================================== --- prosistem/alba/trunk/alba/web/errors/error500.php 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/alba/web/errors/error500.php 2007-02-28 20:20:23 UTC (rev 4346) @@ -0,0 +1,14 @@ +<div align="center"> +<h1>500 - Error Encontrado</h1> +<div class="error"> +<p>Módulo: <?echo $sf_params->get('module')?>, Acción: <? echo $sf_params->get('action')?></p> +</div> +<p> +<br/> +<i>Puede volver hacia atras con su navegador, consulte con el Administrador del sistema.</i> +<br/> + +</p> + +<p><?echo link_to("Volver al Inicio","/")?></p> +</div> \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/web/errors/error500.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Modified: prosistem/alba/trunk/dist/symfony =================================================================== --- prosistem/alba/trunk/dist/symfony 2007-02-28 20:17:38 UTC (rev 4345) +++ prosistem/alba/trunk/dist/symfony 2007-02-28 20:20:23 UTC (rev 4346) @@ -1 +1 @@ -link symfony-0.6.3/ \ No newline at end of file +link symfony-1.0.0/ \ No newline at end of file